• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems with Finder recognizing Unix link/unlink
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with Finder recognizing Unix link/unlink


  • Subject: Problems with Finder recognizing Unix link/unlink
  • From: Eric Seidel <email@hidden>
  • Date: Sun, 20 Jan 2002 23:56:45 +0100

Fellow developers-

I have written OpenAG (a client for the AudioGalaxy file sharing system) over the last couple months (minus the last 3 weeks hiatus where I was without internet access), and have had a bug which has plagued me from the beginning. That being, getting the finder to correctly recognize files that I create or destroy using the POSIX link/unlink commands.

I wrote OpenAG to be very cross platform and therefore do not really have the option of using Cocoa specific commands to add, remove or delete files.

Currently in OpenAG X (aqua overlay onto the OpenAG CLI) I install a callback into OpenAG which is called everytime a modification is made to the disk.

The callback simply does the following:

void notifyFinderOfDirectoryChange(char* theFolder)
{
if (theFolder == NULL)
{
err_print("woh. notifyFinderOfDirectoryChage was passed a null pointer!\n That's no good.\n");
return;
}
/* code to fix "sherlock bug" */
NSString *thePath = [NSString stringWithCString:theFolder];
NSString *thePath2 = [thePath stringByStandardizingPath];
if ((thePath2 != nil) && ([thePath2 length] > 0)) // should prevent it from being nil or empty.
[[NSWorkspace sharedWorkspace] noteFileSystemChanged:thePath2];
else
err_print("error notifying change of path: %s which resolved to: %s\n", theFolder, [thePath2 cString]);
}

err_print is my custom error logging/printing command. effectively printf().

Before I had this callback, my files of course never appeared in the finder until the finder was somehow forced to reload the folder data (using the Goto command (pre 10.1.2) or ???)

When I added the callback and called it on specific file paths, things updated GREAT, BUT as soon as you tried to move one of these files which had been updated in this manner the filename would change from: (only an example)
simon & garfunkel - sounds of silence.mp3
to:
simon & garfunkel - so#23432.mp3
And... disappear from the finder (only visible now via the terminal)

Obviously, this is not a proper solution, but this was what I had found by searching the cocoa.mamasam.com archives.

My latest attempt to solve the problem was to instead of forcing an update of a specific file path, I would call the callback with the directory of the file (thinking that somehow calling noteFileSystemChanged on a filePath and not a folder path might be bad...) , this however ends up with problem #1, that files don't show up in teh first place... and since now as of 10.1.2 the goto command in the finder no longer forces an update of the folder, I have to revert to moving the files around via the terminal to get them to appear in the finder.

Any thoughts would be greatly appreciated...

-eric

p.s. Sources for OpenAG will be soon available at http://sourceforge.net/progjects/openags/

and are currently available (at least in part) on request.


  • Prev by Date: Re: message to nil? (very basic question)
  • Next by Date: Mysterious threads & ObjectAlloc crashes
  • Previous by thread: NSTableView newbie questions
  • Next by thread: Mysterious threads & ObjectAlloc crashes
  • Index(es):
    • Date
    • Thread