プロジェクトバンドルにあるアプリケーションをユーザーのアプリケーションフォルダに移動しようとしています。バンドルされた "testApp.app"は、プロジェクトのResourcesフォルダにあります。私のコードは完了していません。ユーザーのシステム上のグローバルアプリケーションフォルダをどのように指しているか、何か問題がありますか?バンドルされたアプリケーションをアプリケーションフォルダに送信
ありがとうございました。
ポール
NSFileManager* fileManager = [NSFileManager defaultManager];
NSError *error = nil;
NSString *appDirectory = [NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSUserDomainMask, YES)objectAtIndex:0];
NSString *path = [appDirectory stringByAppendingPathComponent:@"~/Applications/testApp.app"];
[path stringByExpandingTildeInPath];
if ([fileManager fileExistsAtPath:path isDirectory:NULL]) {
[fileManager removeItemAtPath:path error:&error];
}
if(![fileManager fileExistsAtPath:path]){
}
NSData *data = [NSData dataWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/testApp.app"]];
[data writeToFile:path atomically:YES];
ありがとうございます。 – Paul