Skip to content

Commit

Permalink
NSFileHandle’s fileHandleForWritingToURL doesn’t like percent-encoded…
Browse files Browse the repository at this point in the history
… filenames
  • Loading branch information
DerekSelander committed Apr 27, 2018
1 parent 8d7469c commit 18fc623
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mobdevim/yoink/yoink.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int yoink_app(AMDeviceRef d, NSDictionary *options) {
}

NSFileManager *manager = [NSFileManager defaultManager];

// write the directories first
for (NSString *path in exploredDirectories) {
NSString *finalizedDirectory = [outputDirectory stringByAppendingPathComponent:path];
Expand All @@ -155,12 +155,12 @@ int yoink_app(AMDeviceRef d, NSDictionary *options) {
continue;
}

NSError *err = NULL;
[[NSFileManager defaultManager] createFileAtPath:finalizedFile contents:nil attributes:nil];
NSFileHandle *handle = [NSFileHandle fileHandleForWritingToURL:[NSURL URLWithString:finalizedFile] error:&err];
if (err) {
dsprintf(stdout, "%s\nExiting...\n", [[err localizedDescription] UTF8String]);
return 1;
NSFileHandle *handle = [NSFileHandle fileHandleForWritingAtPath:finalizedFile];
if (!handle) {
dsprintf(stdout, "%s\nExiting...\n", [finalizedFile UTF8String]);
continue;
// return 1;
}
int fd = [handle fileDescriptor];

Expand Down Expand Up @@ -204,6 +204,7 @@ int yoink_app(AMDeviceRef d, NSDictionary *options) {
dsprintf(stdout, "Opening \"%s\"...\n", [outputDirectory UTF8String]);
if (!quiet_mode) {
NSString *systemCMDString = [NSString stringWithFormat:@"open -R %@", outputDirectory];

system([systemCMDString UTF8String]);
}
} else {
Expand Down

0 comments on commit 18fc623

Please sign in to comment.