Re: App behaves differently when run in Xcode
Re: App behaves differently when run in Xcode
- Subject: Re: App behaves differently when run in Xcode
- From: Sherm Pendley <email@hidden>
- Date: Fri, 28 Oct 2005 03:15:07 -0400
On Oct 28, 2005, at 2:21 AM, Victor Tran wrote:
The problem is when I try to run the Hawk.app file
(after deployment) in the build folder it doesn't
do any of the logging it's supposed to do.
Anyone have any ideas why it's doing this?
How is it determining where to write the logs? Are
you specifying the
full path to the log file, or just the file name?
I specified the path and filename.
e.g. "./logs/imageTest.png"
I suspected something like that, which is why I asked - that's not
the full path to the file.
The "." is the current working directory, which will be different
depending on how your app is launched. When it's launched from Xcode,
it's the build directory. When it's launched from Finder, it's "/".
When it's launched with the "open" command-line tool, it's inherited
from whatever process ran that. In other words, you can't depend on
it having any particular value.
Here's how to get the full path to the current user's recommended log
directory:
NSString *logDir = [@"~/Library/Logs/MyApp"
stringByExpandingTildeInPath];
Note that the standard place for logs is under either ~/Library/Logs
or /Library/Logs, depending on whether they're shared among multiple
users. Even if the current directory were reliable, creating a logs/
directory next to the .app would be a bad idea for other reasons anyway.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden