Skip to content

Commit b48dd9d

Browse files
HelveticaScenarioshazron
authored andcommitted
sanitize file names that include device_id for iPhone xs series (#360)
1 parent f681a59 commit b48dd9d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ios-deploy/ios-deploy.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,8 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
691691

692692
NSString* python_command = @"fruitstrap_";
693693
if(device_id != NULL) {
694-
python_file_path = [python_file_path stringByAppendingString:[NSString stringWithUTF8String:device_id]];
695-
python_command = [python_command stringByAppendingString:[NSString stringWithUTF8String:device_id]];
694+
python_file_path = [python_file_path stringByAppendingString:[[NSString stringWithUTF8String:device_id] stringByReplacingOccurrencesOfString:@"-" withString:@"_"]];
695+
python_command = [python_command stringByAppendingString:[[NSString stringWithUTF8String:device_id] stringByReplacingOccurrencesOfString:@"-" withString:@"_"]];
696696
}
697697
python_file_path = [python_file_path stringByAppendingString:@".py"];
698698

@@ -704,7 +704,7 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
704704
CFDataRef cmds_data = CFStringCreateExternalRepresentation(NULL, cmds, kCFStringEncodingUTF8, 0);
705705
NSString* prep_cmds_path = [NSString stringWithFormat:PREP_CMDS_PATH, tmpUUID];
706706
if(device_id != NULL) {
707-
prep_cmds_path = [prep_cmds_path stringByAppendingString:[NSString stringWithUTF8String:device_id]];
707+
prep_cmds_path = [prep_cmds_path stringByAppendingString:[[NSString stringWithUTF8String:device_id] stringByReplacingOccurrencesOfString:@"-" withString:@"_"]];
708708
}
709709
FILE *out = fopen([prep_cmds_path UTF8String], "w");
710710
fwrite(CFDataGetBytePtr(cmds_data), CFDataGetLength(cmds_data), 1, out);
@@ -963,7 +963,7 @@ void launch_debugger(AMDeviceRef device, CFURLRef url) {
963963
lldb_shell = [NSString stringWithFormat:LLDB_SHELL, prep_cmds];
964964

965965
if(device_id != NULL) {
966-
lldb_shell = [lldb_shell stringByAppendingString: [NSString stringWithUTF8String:device_id]];
966+
lldb_shell = [lldb_shell stringByAppendingString: [[NSString stringWithUTF8String:device_id] stringByReplacingOccurrencesOfString:@"-" withString:@"_"]];
967967
}
968968

969969
int status = system([lldb_shell UTF8String]); // launch lldb
@@ -1002,7 +1002,7 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
10021002
NSString* prep_cmds = [NSString stringWithFormat:PREP_CMDS_PATH, tmpUUID];
10031003
NSString* lldb_shell = [NSString stringWithFormat:LLDB_SHELL, prep_cmds];
10041004
if(device_id != NULL) {
1005-
lldb_shell = [lldb_shell stringByAppendingString:[NSString stringWithUTF8String:device_id]];
1005+
lldb_shell = [lldb_shell stringByAppendingString:[[NSString stringWithUTF8String:device_id] stringByReplacingOccurrencesOfString:@"-" withString:@"_"]];
10061006
}
10071007

10081008
int status = system([lldb_shell UTF8String]); // launch lldb

0 commit comments

Comments
 (0)