Skip to content

Commit c61ccd9

Browse files
committed
windows fix
1 parent a30f9e3 commit c61ccd9

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

client/src/extension.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,35 @@ export async function activate(context: ExtensionContext) {
147147

148148

149149
const runSketch = commands.registerCommand('processing.sketch.run', (resource: Uri) => {
150-
if (!resource) {
151-
return;
152-
}
150+
if (!resource) {
151+
return;
152+
}
153153

154-
// Create a new terminal
155-
if (terminal === undefined) {
156-
terminal = window.createTerminal("Sketch");
157-
}
154+
// Create a new terminal
155+
if (terminal === undefined) {
156+
terminal = window.createTerminal("Sketch");
157+
}
158158

159-
// Show the terminal panel
160-
terminal.show(true);
159+
// Show the terminal panel
160+
terminal.show(true);
161161

162-
// Send the command to the terminal
163-
terminal.sendText(`${selectedVersion.path} cli --sketch=${dirname(resource.fsPath)} --run`, true);
162+
// clear the terminal
163+
terminal.sendText("clear", true);
164164

165-
// clear the terminal
166-
terminal.sendText("clear", true);
167-
});
165+
let path = selectedVersion.path;
166+
if (process.platform === "win32") {
167+
// on windows we need to escape spaces
168+
path = `& "${path}"`;
169+
}
170+
171+
// Send the command to the terminal
172+
terminal.sendText(
173+
`${path} cli --sketch=${dirname(
174+
resource.fsPath
175+
)} --run`,
176+
true
177+
);
178+
});
168179

169180
const stopSketch = commands.registerCommand('processing.sketch.stop', () => {
170181
if (terminal === undefined) {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)