• 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
currentDirectoryPath does not work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

currentDirectoryPath does not work


  • Subject: currentDirectoryPath does not work
  • From: James Ludtke <email@hidden>
  • Date: Mon, 23 Jun 2003 13:57:25 -0400

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.

  • Follow-Ups:
    • Re: currentDirectoryPath does not work
      • From: Douglas Davidson <email@hidden>
    • RE: currentDirectoryPath does not work
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: currentDirectoryPath does not work
      • From: Fritz Anderson <email@hidden>
    • Re: currentDirectoryPath does not work
      • From: Rolf <email@hidden>
  • Prev by Date: Re: crash when loading nib
  • Next by Date: Re: currentDirectoryPath does not work
  • Previous by thread: Re: Overlapping focus rings, clipping?
  • Next by thread: Re: currentDirectoryPath does not work
  • Index(es):
    • Date
    • Thread