PDA

View Full Version : app only works when debugging inside xcode?




bajsko
Aug 7, 2012, 11:51 AM
Hi, i have made an app that extracts a zip files contents, everything works when i run it inside xcode, but when i just double click the .app it doesn't extract:( Do i need some permission or something please help!:(



rcplusplus
Aug 7, 2012, 04:58 PM
I believe that when running inside xcode the current directory is where your app is, while when running it from the finder, its the home (users/***) directory. Im not sure, but if thats the case, then you can get the directory of your app and set the current directory to that

rcplusplus
Aug 7, 2012, 05:16 PM
By the way, if you're using c++, then you may be able to use argv[0]. Or if you're using the Foundation framework, go through the documentation for NSFileManager and see what they have for you.

bajsko
Aug 8, 2012, 03:47 AM
I believe that when running inside xcode the current directory is where your app is, while when running it from the finder, its the home (users/***) directory. Im not sure, but if thats the case, then you can get the directory of your app and set the current directory to that

Look, the directory is /Applications/AnAppWichContainsAZipFile
So, shouldn't it just work?

chown33
Aug 8, 2012, 11:41 AM
Look, the directory is /Applications/AnAppWichContainsAZipFile
So, shouldn't it just work?

You'll have to provide more details than that.

First, did you make an actual bundled app, or a command-line tool? Are you passing parameters? What are they? Are you using builtin or hard-wired pathnames, or does your code dynamically determine the pathnames of files?

Second, exactly what fails? Does the program fail to find the zip file? Does it fail to open it? Fail when parsing? Fail when writing extracted data? Exactly where is it trying to write the data? Exactly what are the pathnames of the input and output files?

Third, what is the code? Did you write it yourself from scratch? Copy it from somewhere? Where?