bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDocument and symlinks


From: Rob Burns
Subject: NSDocument and symlinks
Date: Fri, 29 Apr 2005 17:46:37 +0700

I found recently that when using Gworkspace to open a file which was actually a symlink to a file, the correct app would come to the foreground, but then display an error message stating that the "file" (actually the path to the symlink) couldn't be opened. These were NSDocument based applications. TextEdit had no problems opening symlinks from GWorkspace. So, I took this bit of code from TextEdit and put it at the beginning of the openDocumentWithContentsOfFile: display: method of NSDocumentController.

NSString *resolvedSymlinks = [fileName stringByResolvingSymlinksInPath];
  if ([resolvedSymlinks length] > 0)
    {
NSString *standardized = [resolvedSymlinks stringByStandardizingPath]; fileName = [standardized length] ? standardized : resolvedSymlinks;
    }

It all seemed to work ok after that. I specify opening from GWorkspace, because when using the Backbone projects' 'open' tool, all apps including NSDocument based apps worked fine (without the small fix). I'm not sure what the results are with the 'open' tool that comes with GNUstep.

Thanks
Rob






reply via email to

[Prev in Thread] Current Thread [Next in Thread]