On 22, Jan, 2012, at 01:17 AM, John Joyce wrote:

> 
> On Jan 21, 2012, at 6:09 PM, Ken Thomases wrote:
> 
>> 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
>> 
> Hi Martin,
> 
> To best verify this yourself, create a new user account on a Mac, set Spanish 
> to the top of the list of preferred languages in System Preferences > Text & 
> Language
> Log out, log back in to that user to ensure that all apps and processes in 
> that user account are in Spanish.
> Check the contents of the ~/Documents folder in terminal using ls
> run your app to recreate the situation.
> You'll find out really fast if your app is doing something nasty.
> 

OK, good tip. I tried this but there was no way that I could convince the "Save 
As" dialog to point to a folder called "Documents" it only showed me 
"Documentos" and saving there caused no problems. The user stated that they had 
"Documents" in the "Where:" field of the "Save As" dialog. I've no idea how 
they managed to have that. Any ideas?

Thanks for the input,

Martin


> HTH
> John

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: [email protected]
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






_______________________________________________

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