Hi i am creating a Cocoa application in Objective C using XCode. In this project i am writing some text in the sample.txt file which is located at the current directory i.e. if my .app(application) file is at desktop then sample.txt is also at Desktop.
I am getting current directory path using this code line
NSString *curDir = [[NSFileManager defaultManager] currentDirectoryPath];
then i am appending @"/sample.txt" string.
Now when we build project using "Build & Go", text is getting write into file sample.txt located at current directory. But if we stop application & run built .app file (Like .exe file in Windows) it does not write file sample.txt at the current directory while it tries to find out sample.txt at root folder (In Macintosh HD).
Now i want that my built .app (Like .exe) file should write sample.txt only at current directory of my application.
Why its not getting work please help me out. Any help is appreciated. Thanks in advance.
I am getting current directory path using this code line
NSString *curDir = [[NSFileManager defaultManager] currentDirectoryPath];
then i am appending @"/sample.txt" string.
Now when we build project using "Build & Go", text is getting write into file sample.txt located at current directory. But if we stop application & run built .app file (Like .exe file in Windows) it does not write file sample.txt at the current directory while it tries to find out sample.txt at root folder (In Macintosh HD).
Now i want that my built .app (Like .exe) file should write sample.txt only at current directory of my application.
Why its not getting work please help me out. Any help is appreciated. Thanks in advance.