• 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
A slight addendum to the Finder recognizing link/unlink problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A slight addendum to the Finder recognizing link/unlink problem


  • Subject: A slight addendum to the Finder recognizing link/unlink problem
  • From: Eric Seidel <email@hidden>
  • Date: Mon, 21 Jan 2002 00:27:53 +0100

Just a minor addition...

I also tried this evening using the NSWorkspace command notifyFileSystemChanged without a command parameter. That gave the same result, that the files did not appear.

I should also note, that I am moving files in what I would consider the "standard unix fashion" of making a second (hard) link to the file in the place where I want it moved and then removing the first (hard) link to the file.

Thus, my code for moving files is exactly what you would find in say the BASH source... etc.

a snippet from my source:

/* Move the file */
if(link(PathFrom, PathTo) == 0)
{
if(unlink(PathFrom) != 0)
{
if(unlink(PathTo) !=0)
err_exit("Error encountered while moving files... Filelinks may be corrupt... \nFrom: %s\nTo: %s\nPlease report.\n", PathFrom, PathTo);
else
err_print("Download complete, but linking errors prevented file move.\nFrom: %s\nTo: %s Check to make sure that the chosen sharing directory exists then please report.\n", PathFrom, PathTo);
}
else
{
// moved fine, now update path information:
if ((STATS.connections[i].FileDirectory != 0) && (STATS.connections[i].FileDirectory != NULL))
delete(STATS.connections[i].FileDirectory); // should be ok.
STATS.connections[i].FileDirectory = strdup(STATS.Prefs->FinishedDownloadsDirectory);
}
}
else
{
if (errno = EACCES)
err_print("Between the time that I checked, and when I actually moved the file,
another either a file appeared in the completed downloads directory with the deisred name, OR you deleted the file in the temporary directory.
Please report this error. The file: %s, will be left in the temporary directory:
%s\n", STATS.connections[i].FileName, STATS.connections[i].FileDirectory);
else
err_print("Download complete, but there was an unhandled error moving it to the completed downloads directory. PLEASE REPORT THIS ERROR.\n");
}


STATS is my big structure with all the client variables in it... including The Preferences structure and the database structures for a list of resumeable downloads and shared files. STATS.connections is an array of the connections .FileDirectory is the Directory of the file (if there is one) associated with that connection.
err_print is again just my fancy err printing function. Think of it as a printf() command.

I also considered this evening, that instead of having a callback to notify the finder that I moved a file, I could instead have a callback that actually does the file moving for me... maybe that would be easier... of course I still would need one to handle updating the finder when I create or completely remove files.

It seems to me that the notifyFileSystemChanged:FilePath command is having some trouble with the way that I move files... In that it doesn't like the links that I make via the link/unlink commands... almost as though there is extra directory information which is not getting associated properly, or that that same directory information is getting hosed when I unlink the original file... thoughts are always appreciated...

Thanks again for all your time.

-eric


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