Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bf8f7cc

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committedJul 21, 2015
Fix ios debugger for projects created with framework version lower than 1.2.0
1 parent 52efd25 commit bf8f7cc

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
 

‎lib/services/ios-debug-service.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import stream = require("stream");
66
import path = require("path");
77
import http = require("http");
88
import Future = require("fibers/future");
9+
import semver = require("semver");
910

1011
module notification {
1112
function formatNotification(bundleId: string, notification: string) {
@@ -71,7 +72,8 @@ class IOSDebugService implements IDebugService {
7172
private $errors: IErrors,
7273
private $injector: IInjector,
7374
private $npmInstallationManager: INpmInstallationManager,
74-
private $options: IOptions) { }
75+
private $options: IOptions,
76+
private $projectDataService: IProjectDataService) { }
7577

7678
get platform(): string {
7779
return "ios";
@@ -142,6 +144,7 @@ class IOSDebugService implements IDebugService {
142144
});
143145
awaitNotification(npc, notification.readyForAttach(projectId), 5000).wait();
144146
} catch(e) {
147+
this.$logger.trace(`Timeout error: ${e}`);
145148
this.$errors.failWithoutHelp("Timeout waiting for NativeScript debugger.");
146149
}
147150

@@ -205,9 +208,20 @@ class IOSDebugService implements IDebugService {
205208
private openDebuggingClient(): IFuture<void> {
206209
return (() => {
207210
let inspectorPath = this.getInspectorPath().wait();
208-
let inspectorApplicationPath = path.join(inspectorPath, "NativeScript Inspector.app");
209-
let inspectorSourceLocation = path.join(inspectorPath, "Safari/Main.html");
210-
let cmd = `open -a '${inspectorApplicationPath}' --args '${inspectorSourceLocation}' '${this.$projectData.projectName}'`;
211+
let cmd: string = null;
212+
213+
this.$projectDataService.initialize(this.$projectData.projectDir);
214+
let platformData = this.$platformsData.getPlatformData(this.platform);
215+
let frameworkVersion = this.$projectDataService.getValue(platformData.frameworkPackageName).wait().version;
216+
if(semver.lt(frameworkVersion, "1.2.0")) {
217+
let safariPath = path.join(inspectorPath, "Safari/Main.html");
218+
cmd = "open -a Safari " + safariPath;
219+
} else {
220+
let inspectorApplicationPath = path.join(inspectorPath, "NativeScript Inspector.app");
221+
let inspectorSourceLocation = path.join(inspectorPath, "Safari/Main.html");
222+
cmd = `open -a '${inspectorApplicationPath}' --args '${inspectorSourceLocation}' '${this.$projectData.projectName}'`;
223+
}
224+
211225
this.$childProcess.exec(cmd).wait();
212226
}).future<void>()();
213227
}

0 commit comments

Comments
 (0)
Please sign in to comment.