cocoa - How to move a symlink to the trash? -


I do not see any option to see the following link for the FSPathMoveObjectToTrashSync () function.

Here I have tried

Create a link and a file

  [21:32:41 / tmp] $ my_file Touch [21 : 32:45 / TMP] $ ln -s my_file my_link [21:32:52 / TMP] $ Total Total 8 DrucksRawcServe 12 Root Wheel 408 17 Major 21:32 Drwxr-xr-x @ 6 Route wheel 20 9 Sep. 2009. -R-R-R1 Nini Wheel 0 17 Major 21:32 my_file lrwxr-xr-x 1 Nanny Wheel 7 17 Major 21:32 my_link - & Gt; My_file  

Take the trash to the link

  OSStatus status = FSPathMoveObjectToTrashSync ("/ tmp / my_link", NULL, kFSFileOperationDefaultOptions); NSLog (@ "Status:% i", (Int.));  

Output is

  Status: 0  

Although the file was removed and no links

  [21:32:55 / TMP] $ Total Total 8 DrucksRawsServe 11 Root Wheel 374 17 Major 21:33 Drwxr-xr-x @ 6 Route Wheel 20 9 Sep. 2009 Lrwxr-xr-x 1 Nini Wheel 7 17 Major 21:32 my_link - & gt; My_file [21:33:05 / tmp] $  

How can I move step simulation in trash?


Solution .. Thanks for Rob Napier

  NSString * path = @ "/ tmp / my_link"; OSStatus condition = 0; FSRF referee; Position = F. SPathMakeRefWithOptions ((const UInt8 *) [path file system refraction], KFSP and M. rifedo notifolik lef simal link, and ref, tap); NSAssert ((condition == 0), @ "Failed to create FSFF"); Position = FSMoveObjectToTrashSync (and ref, tap, KFS file operation default option); NSLog (@ "Status:% i", (Int.)); Use  FSPathMakeRefWithOptions ()  to generate an FSRef 

To contact Then use the FSMoveObjectToTrashSync () to remove it.


Comments