Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get extension of a file??



On 9/30/05 12:03 AM, Mita Baxi didst favor us with:

> 
> 
> yes it does return the name user entered,but if I save a '.txt' file as
> 'abc' and than I create a new file and save it as 'abc.txt' a new file
> is created in the same location.
> 
> Instead some error message like "File already exists at this location"
> should  popup.

Why? "abc" and "abc.txt" are different names.
> 
> So I simply want to make a check before saving this file if a file with
> same name exists or not.Presently I check this by creating an FSRef for
> the path,if it is valid the file exists else it doesn't.

Yes, that's how I check for one, but I don't see the problem.
> 
> Also the documentation for NavDialogGetSaveFileName says that it would
> return me a filename with extension irrespective of whether user
> specified the file extension or not.

No, it doesn't. What it says is this:

"On Mac OS X, the full filename is returned, including any extension that
may be hidden from the user."

It does not say NavDialogGetSaveFileName will add an extension for you, and
two seconds of thought would make that obvious. NavDialogGetSaveFileName
will return the name with the extension whether the extension is visible or
not *if* there's an extension to return. Why would you expect
NavDialogGetSaveFileName to know what extension needs to be added if you
don't supply one in the initial name and the user doesn't provide one? It's
not like ".txt" is the only extension out there, you know? You need to think
through this a little more. There's nothing wrong here.

Larry
> 
> 
> 
> -----Original Message-----
> From: Laurence Harris [mailto:email@hidden]
> Sent: Thursday, September 29, 2005 8:44 PM
> To: Mita Baxi; email@hidden
> Subject: Re: How to get extension of a file??
> 
> 
> 
> On 9/29/05 11:06 AM, Mita Baxi didst favor us with:
> 
> 
> 
>> Is there any way to get an extension of a file after running
> navigation
> 
>> dialog .
> 
> 
> 
> If this is a save file dialog, there's no file from which to get a name
> or
> 
> extension.
> 
>> 
> 
>> I got one API "NavDialogGetSaveFilename" which states that it'll
> return
> 
>> fullname of file alongwith its extension, but it is not returning the
> 
>> same.
> 
> 
> 
> It should be returning whatever the user entered in the dialog. Is that
> not
> 
> the case?
> 
> 
> 
> Larry
> 
> 
> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >RE: How to get extension of a file?? (From: "Mita Baxi" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.