Skip to content

Commit f9307ab

Browse files
Merge pull request #115 from telerik/vladimirov/fix-get-app-container
fix: get_app_container returns non-existent path
2 parents 87dac2f + f234c5a commit f9307ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/simctl.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import childProcess = require("./child-process");
22
import * as child_process from "child_process";
33
import errors = require("./errors");
44
import * as _ from "lodash";
5+
import * as fs from "fs";
56

67
export class Simctl implements ISimctl {
78

@@ -50,7 +51,9 @@ export class Simctl implements ISimctl {
5051

5152
public async getAppContainer(deviceId: string, appIdentifier: string): Promise<string> {
5253
try {
53-
return await this.spawnAsync("get_app_container", [deviceId, appIdentifier]);
54+
const appContainerPath = await this.spawnAsync("get_app_container", [deviceId, appIdentifier]);
55+
// In case application is not installed on simulator, get_app_container returns some random location. After you installation, the application goes in a different location.
56+
return fs.existsSync(appContainerPath) ? appContainerPath : null;
5457
} catch (e) {
5558
if (e.message.indexOf("No such file or directory") > -1) {
5659
return null;

0 commit comments

Comments
 (0)