Recent

Author Topic: Open File Properties Dialog on 64-Bit Mac  (Read 193 times)

LazProgger

  • Jr. Member
  • **
  • Posts: 91
Open File Properties Dialog on 64-Bit Mac
« on: August 08, 2019, 07:35:14 pm »
In 32-Bit Carbon, I used the following code for opening the file properties dialog of a file:

Code: Pascal  [Select]
  1.  
  2. procedure MacShowSystemFilePropertyDialog(AFileName: string);
  3. var
  4.   ANSPasteboard: NSPasteboard;
  5.   ANSFile: NSString;
  6.   ANSFiles, ANSTypes: NSMutableArray;
  7. begin
  8.  
  9.   ANSFile := NSSTR(pchar(AFileName));
  10.  
  11.   ANSFiles := NSMutableArray.alloc.init;
  12.   ANSFiles.addObject(ANSFile);
  13.  
  14.   ANSTypes := NSMutableArray.alloc.init;
  15.   ANSTypes.addObject(NSStringPboardType);
  16.  
  17.   ANSPasteboard := NSPasteboard.pasteboardWithUniqueName;
  18.   ANSPasteboard.declareTypes_owner(ANSTypes, nil);
  19.   ANSPasteboard.setPropertyList_forType(ANSFiles, NSFilenamesPboardType);
  20.  
  21.   NSPerformService(NSSTR(PChar('Finder/Show Info')), ANSPasteboard);
  22.  
  23.   ANSFiles.release;
  24.   ANSTypes.release;
  25.   ANSPasteBoard.release;
  26.  
  27. end;
  28.  
  29.  

In 64-Bit Cocoa this is not working any more. I get the an error with NSStringPboardType and NSFilenamesPboardType. The errors are both the same:

ld: 32-bit RIP relative reference out of range (-4297995934 max is +/-4GB): from _..._$$_...$crc9E1F315A (0x1002E35F0) to _NSStringPboardType@0x00000000 (0x00000000) in '_..._$$_...' from /Users/.../lib/x86_64-darwin/FileAttributes.o for architecture x86_64

Has someone an idea what I can do? I also get such errors with NSFileExtensionHidden, NSFileImmutable and other of such "external string constants" like that. Do I have to do some type of type cast? Do I have to use a 64 bit version or something like that?
« Last Edit: August 08, 2019, 07:38:39 pm by LazProgger »

LazProgger

  • Jr. Member
  • **
  • Posts: 91
Re: Open File Properties Dialog on 64-Bit Mac
« Reply #1 on: August 09, 2019, 02:38:43 pm »