I have a little app that writes alias files to its App Support folder on a regular basis. The app is sandboxed, so that ends up in ~/Library/Containers/<apputi>/Data/Library/Application Support/<appname> The file name of the alias file is always the same. The old alias file is deleted before the new one is created. If I step through the code in Xcode, I see the old alias file go away (removeItemAtPath:error:) and then the new alias file appears (writeBookmarkData:toURL:options:error:). Finder things the new alias file really does point to the new file. Great.
But if I just let the app run normally, the Finder will keep showing an old version of the file that the alias file points to, even after it's been deleted and re-created many times. The only way I've been able to make it show the actual file is to relaunch Finder (or step through, as above).
What's going on here? The creation and mod date on the alias file is correct (the newest creation date). If I double-click the alias file, it opens the correct file. It's just seems to be Finder that is stuck thinking it still points to the old file. These actions all show the old file:
-Original field in Get Info window
-Preview in Get Info window
-QuickLook
-Show Original
Is there some Cocoa method I can call to force Finder to kick its cache in the butt? If not, I'll just report this horrible bug.
--
Steve Mills
Drummer, Mac geek