On Jan 21, 2012, at 7:32 AM, Martin Hewitson wrote:

> I have a user that has been using a document based app of mine and they are 
> reporting something very strange.
> 
> The user is Spanish and so had a "Documentos" folder in his home directory. 
> He created a new document in this app then went to save it. In the "Where" 
> part of the save dialog it said "Documents". He went ahead and tried to save 
> the document to this "Documents" folder. He says the result is that his 
> "Documentos" folder has disappeared and there is now a "Documents" folder. 
> All the files that were in "Documentos" have now disappeared. I use nothing 
> special in the app. It's a very standard NSDocument app which uses and 
> override of -writeToURL:ofType:error: to save the contents of a textview to 
> disk. The save dialog is the standard one presented by the document 
> architecture; I don't modify it. 
> 
> Does anyone have a clue what could have happened?

Mac OS X doesn't localize the names of folders on disk.  It only localizes them 
in the standard GUI (e.g. Finder and Open and Save dialogs) and via display 
name APIs such as -[NSFileManager displayNameAtPath:].

So, the Documents folder is always named "Documents" on disk, even for a 
Spanish user.

An important component of the localization mechanism for standard folders is 
that there's an empty, hidden file named ".localized" inside of the Documents 
folder.  Without that special file, the display name APIs and the standard GUI 
won't display the localized name.

If every file within ~/Documents were deleted, including .localized, then that 
folder's name would cease to be localized.

Since the Save dialog was showing the folder name as "Documents" instead of 
"Documentos", then I would guess that all of the files had been deleted before 
the user went to save the file in your app.  I can't guess what would have 
deleted those files, but the evidence suggests it wasn't your app -- or, at 
least, it wasn't the save process.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to