Programmverzeichnis auslesen |
|
|
|
Geschrieben von: Philipp
|
FRIDAY, 25 JULY 2008 17:36 |
Um den Pfad zu Eurer Applikation auf dem iPhone heraus zubekommen ganz einfach folgendes ausführen:
NSString * applicationPath = NSHomeDirectory();
//z.B. /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175-ECA3-4F10-A69C-B4FD62696C51
Hier sind einige weitere interessante Pfade zu betrachten:
NSLog(@"Support path: %@", [[NSBundle mainBundle] resourcePath]);
//z.B. /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/MyApp.app
NSLog(@"executable path: %@", [[NSBundle mainBundle] executablePath]);
//z.B. /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/MyApp.app/MyApp
NSLog(@"privateFrameworksPath path: %@", [[NSBundle mainBundle] privateFrameworksPath]);
//z.B. /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/MyApp.app/Frameworks
NSLog(@"sharedFrameworksPath path: %@", [[NSBundle mainBundle] sharedFrameworksPath]);
//z.B. /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/MyApp.app/SharedFrameworks
NSLog(@"sharedSupportPath path: %@", [[NSBundle mainBundle] sharedSupportPath]);
//z.B. /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/MyApp.app/SharedSupport
NSLog(@"dictionary: %@", [[[NSBundle mainBundle] infoDictionary] description]);
Interessant ist auch folgender Ansatz:
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
//z.B: /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/Documents
[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
//z.B: /Users/philipp.homann/Library/Application Support/iPhone Simulator/5.1/Applications/271E7175...51/Library
|
LAST_UPDATED2 |