Skip to content

Commit 1ecd204

Browse files
tristanlabelleadam-fowler
authored andcommitted
Fix debug config path formats on Windows. (#613)
1 parent 3bebd59 commit 1ecd204

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/debugger/launch.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import * as os from "os";
16+
import * as path from "path";
1617
import * as vscode from "vscode";
1718
import configuration from "../configuration";
1819
import { FolderContext } from "../FolderContext";
@@ -113,14 +114,15 @@ function createExecutableConfigurations(ctx: FolderContext): vscode.DebugConfigu
113114
const executableProducts = ctx.swiftPackage.executableProducts;
114115
const { folder, nameSuffix } = getFolderAndNameSuffix(ctx);
115116
const buildDirectory = BuildFlags.buildDirectoryFromWorkspacePath(folder, true);
117+
const binaryExtension = process.platform === "win32" ? ".exe" : "";
116118
return executableProducts.flatMap(product => {
117119
return [
118120
{
119121
type: DebugAdapter.adapterName,
120122
request: "launch",
121123
sourceLanguages: ["swift"],
122124
name: `Debug ${product.name}${nameSuffix}`,
123-
program: `${buildDirectory}/debug/` + product.name,
125+
program: path.join(buildDirectory, "debug", product.name + binaryExtension),
124126
args: [],
125127
cwd: folder,
126128
preLaunchTask: `swift: Build Debug ${product.name}${nameSuffix}`,
@@ -131,7 +133,7 @@ function createExecutableConfigurations(ctx: FolderContext): vscode.DebugConfigu
131133
request: "launch",
132134
sourceLanguages: ["swift"],
133135
name: `Release ${product.name}${nameSuffix}`,
134-
program: `${buildDirectory}/release/` + product.name,
136+
program: path.join(buildDirectory, "release", product.name + binaryExtension),
135137
args: [],
136138
cwd: folder,
137139
preLaunchTask: `swift: Build Release ${product.name}${nameSuffix}`,
@@ -159,7 +161,7 @@ export function createSnippetConfiguration(
159161
request: "launch",
160162
sourceLanguages: ["swift"],
161163
name: `Run ${snippetName}`,
162-
program: `${buildDirectory}/debug/${snippetName}`,
164+
program: path.join(buildDirectory, "debug", snippetName),
163165
args: [],
164166
cwd: folder,
165167
env: swiftRuntimeEnv(true),
@@ -235,7 +237,11 @@ export function createTestConfiguration(
235237
request: "launch",
236238
sourceLanguages: ["swift"],
237239
name: `Test ${ctx.swiftPackage.name}`,
238-
program: `${buildDirectory}/debug/${ctx.swiftPackage.name}PackageTests.xctest`,
240+
program: path.join(
241+
buildDirectory,
242+
"debug",
243+
ctx.swiftPackage.name + "PackageTests.xctest"
244+
),
239245
cwd: folder,
240246
env: testEnv,
241247
preRunCommands: preRunCommands,

0 commit comments

Comments
 (0)