Re: Trouble using createFileAtPath method to create file
Re: Trouble using createFileAtPath method to create file
- Subject: Re: Trouble using createFileAtPath method to create file
- From: "Jaime Rios" <email@hidden>
- Date: Fri, 12 Oct 2007 10:27:23 -0400
Actually, that is the older code where I was using a const char* for the
file name. I'm not using that anymore and instead I am using a CFStringRef
for the file name and a CFURLRef for the file path. However, it still fails
to create a file at that path:
NSString* pFP = [(NSString*)CFURLCopyPath(sourcePath)
stringByAppendingPathComponent:
(NSString*)fileName];
Any ideas? Thanks!
--
-Jaime
http://www.jaimerios.com
On 10/12/07, glenn andreas <email@hidden> wrote:
>
>
> On Oct 12, 2007, at 9:10 AM, Jaime Rios wrote:
>
> > Hi,
> > I'm having trouble using the createFileAtPath method to create a
> > file in the
> > following directory:
> > /private/var/tmp/folders.501/Cleanup At Startup
> >
> > The code that I am using to attempt creating the file is:
> > NSString* pFP = [(NSString*)sourcePath
> > stringByAppendingPathComponent:
> > [NSString stringWithCString:fileName
> > encoding:30]];
>
> 1) What is encoding 30? You should use one of the predefined
> symbolic constants, not some value like 30.
>
> 2) How are you getting that sourcePath? If you've hardcoded it in,
> you're just begging for trouble, even if it it does work (since that
> won't work for other users). Your best bet is to use FSFindFolder,
> use CFURLCreateFromFSRef to convert that fsref to a URL, and then get
> the path from that.
>
>
>
>
>
> Glenn Andreas email@hidden
> <http://www.gandreas.com/> wicked fun!
> quadrium2 | build, mutate, evolve, animate | images, textures,
> fractals, art
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden