send the path of your appium inside double quotes.
how to sent current directory path(Space in the path) into terminal via xcode application
Question
I have to run a script from Objective C code. my script server.js is located at the path
/Users/SS/Desktop/iPhone App/Appium.app/Contents/Resources/node_modules/appium/server.js
In objective c code, I set the path as
[self.serverTask setCurrentDirectoryPath:[NSString stringWithFormat:@"%@/%@", @"/Users/SS/Desktop/iPhone App/Appium.app/Contents/Resources", @"node_modules/appium"]];
launch path with argument
[self.serverTask setLaunchPath:@"/bin/bash"]; [self.serverTask setArguments: [NSArray arrayWithObjects: @"-l", @"-c", nodeCommandString, nil]];
The problem I am facing is that when I am running XCode application, it is receiving only the path before the space (i.e. /Users/SS/Desktop/iPhone) and through an error
/bin/bash: /Users/SS/Desktop/ab: No such file or directory
Is there is an idea by which I can access path after the spaces.
Solution
OTHER TIPS
Change your path like this./
[self.serverTask setCurrentDirectoryPath:[NSString stringWithFormat:@"%@/%@", @"/Users/SS/Desktop/iPhone\ App/Appium.app/Contents/Resources", @"node_modules/appium"]];
Add \
before the space.
Send the path of your appium inside double quotes like following.
[self.serverTask setCurrentDirectoryPath:[NSString stringWithFormat:@"%@/%@", @"/Users/SS/Desktop/iPhone\ App/Appium.app/Contents/Resources", @"node_modules/appium"]];