• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: currentDirectoryPath does not work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: currentDirectoryPath does not work


  • Subject: RE: currentDirectoryPath does not work
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Mon, 23 Jun 2003 14:30:44 -0400

I think what you want is

myPath = [[[NSBundle mainBundle] bundlePath]
stringByDeletingLastPathComponent];

Jonathan

> -----Original Message-----
> From: email@hidden
> [mailto:email@hidden]On Behalf Of James Ludtke
> Sent: Monday, June 23, 2003 1:57 PM
> To: email@hidden
> Subject: currentDirectoryPath does not work
>
>
> I am trying to read and write from my application to a file that is in the
> same folder as my application. because I can not be certain where
> a user may
> put the folder, I do not know the absolute path. The following code works
> when I run my application from within the Project Builder, but
> fails when I
> run the compiled application. The compiled application reads from
> and writes
> to root. This includes the application in the build folder.
>
> myPath = [[NSFileManager defaultManager] currentDirectoryPath];
> myFile = @"dsf.txt";
> myFilePath = [myPath stringByAppendingPathComponent: myFile];
> myStatusString = [NSString stringWithContentsOfFile: myFilePath];
>
> I also tried the Unix relative path method, e.g,
>
> myPath = @"./"
>
> This also works from within Project Builder but again fails from the
> compiled application.
>
> Is this a bug in Cocoa, or what am I doing wrong?
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >currentDirectoryPath does not work (From: James Ludtke <email@hidden>)

  • Prev by Date: Re: currentDirectoryPath does not work
  • Next by Date: Wait until task is finished?
  • Previous by thread: Re: currentDirectoryPath does not work
  • Next by thread: Re: currentDirectoryPath does not work
  • Index(es):
    • Date
    • Thread