I want to debug some stuff in my application by dumping text to a file, like this:
FILE *file;
file = fopen("/tmp/file.txt","a+");
fprintf(file,"%s\n", "silly debug message");
fclose(file);
That works when I run the file as ./myapplication. But when I bundle it as an app bundle (using gtk-osx-application and gtk-mac-bundler) and run the app bundle, the file isn’t created. It fails silently and continues execution.
Any ideas why? Is there some sandboxing going on?
OK, this isn’t a real question anymore. The problem was that I had an extra MyApp.app in the root folder / in addition to the app I thought I was testing in /Application. When using “open -a MyApp”, the old app version in the root folder was used.
That’s a couple of hours of my life that I’ll never get back. Oh well. Thanks for you feedback, people. I know more about NSLog(), CFShow(), CFString and syslog() now, and that’s extremely helpful nonetheless.