Skip to content

Commit 8179168

Browse files
Fix tns_modules added to app dir (#3154)
In some cases `tns_modules` dir may appear in project's app dir. The issue is caused by sending Ctrl + C while `ios-sim-portable` is executing `xcrun simctl` command. In this case, it returns empty string for applicationPath instead of breaking the CLI process. Add new check if the projectRoot on device is not empty string and update ios-sim-portable.
1 parent 74ab679 commit 8179168

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

lib/device-path-provider.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import * as path from "path";
66
export class DevicePathProvider implements IDevicePathProvider {
77
constructor(private $mobileHelper: Mobile.IMobileHelper,
88
private $injector: IInjector,
9-
private $iOSSimResolver: Mobile.IiOSSimResolver) {
9+
private $iOSSimResolver: Mobile.IiOSSimResolver,
10+
private $errors: IErrors) {
1011
}
1112

1213
public async getDeviceProjectRootPath(device: Mobile.IDevice, options: IDeviceProjectRootOptions): Promise<string> {
1314
let projectRoot = "";
1415
if (this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform)) {
15-
if (device.isEmulator) {
16-
const applicationPath = this.$iOSSimResolver.iOSSim.getApplicationPath(device.deviceInfo.identifier, options.appIdentifier);
17-
projectRoot = path.join(applicationPath);
18-
} else {
19-
projectRoot = LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH;
16+
projectRoot = device.isEmulator ? this.$iOSSimResolver.iOSSim.getApplicationPath(device.deviceInfo.identifier, options.appIdentifier) : LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH;
17+
18+
if (!projectRoot) {
19+
this.$errors.failWithoutHelp("Unable to get application path on device.");
2020
}
2121

2222
if (!options.getDirname) {

npm-shrinkwrap.json

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"inquirer": "0.9.0",
4747
"ios-device-lib": "0.4.10",
4848
"ios-mobileprovision-finder": "1.0.10",
49-
"ios-sim-portable": "3.1.2",
49+
"ios-sim-portable": "3.1.3",
5050
"lockfile": "1.0.3",
5151
"lodash": "4.13.1",
5252
"log4js": "1.0.1",

0 commit comments

Comments
 (0)