Skip to content

Commit cf4f48a

Browse files
committed
Allow building of projects with spaces in directory names on Windows
See NativeScript/NativeScript#1213
1 parent 329c371 commit cf4f48a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/services/android-project-service.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
222222
}
223223

224224
let gradleBin = this.useGradleWrapper(projectRoot) ? path.join(projectRoot, "gradlew") : "gradle";
225+
if (this.$hostInfo.isWindows) {
226+
gradleBin += ".bat"; // cmd command line parsing rules are weird. Avoid issues with quotes. See https://github.com/apache/cordova-android/blob/master/bin/templates/cordova/lib/builders/GradleBuilder.js for another approach
227+
}
225228
this.spawn(gradleBin, buildOptions, { stdio: "inherit", cwd: this.platformData.projectRoot }).wait();
226229
} else {
227230
this.checkAnt().wait();
@@ -368,11 +371,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
368371
}
369372

370373
private spawn(command: string, args: string[], opts?: any): IFuture<void> {
371-
if (this.$hostInfo.isWindows) {
372-
args.unshift('/s', '/c', command);
373-
command = process.env.COMSPEC || 'cmd.exe';
374-
}
375-
376374
return this.$childProcess.spawnFromEvent(command, args, "close", opts || { stdio: "inherit"});
377375
}
378376

0 commit comments

Comments
 (0)