13
13
//===----------------------------------------------------------------------===//
14
14
15
15
import * as os from "os" ;
16
+ import * as path from "path" ;
16
17
import * as vscode from "vscode" ;
17
18
import configuration from "../configuration" ;
18
19
import { FolderContext } from "../FolderContext" ;
@@ -113,14 +114,15 @@ function createExecutableConfigurations(ctx: FolderContext): vscode.DebugConfigu
113
114
const executableProducts = ctx . swiftPackage . executableProducts ;
114
115
const { folder, nameSuffix } = getFolderAndNameSuffix ( ctx ) ;
115
116
const buildDirectory = BuildFlags . buildDirectoryFromWorkspacePath ( folder , true ) ;
117
+ const binaryExtension = process . platform === "win32" ? ".exe" : "" ;
116
118
return executableProducts . flatMap ( product => {
117
119
return [
118
120
{
119
121
type : DebugAdapter . adapterName ,
120
122
request : "launch" ,
121
123
sourceLanguages : [ "swift" ] ,
122
124
name : `Debug ${ product . name } ${ nameSuffix } ` ,
123
- program : ` ${ buildDirectory } / debug/` + product . name ,
125
+ program : path . join ( buildDirectory , " debug" , product . name + binaryExtension ) ,
124
126
args : [ ] ,
125
127
cwd : folder ,
126
128
preLaunchTask : `swift: Build Debug ${ product . name } ${ nameSuffix } ` ,
@@ -131,7 +133,7 @@ function createExecutableConfigurations(ctx: FolderContext): vscode.DebugConfigu
131
133
request : "launch" ,
132
134
sourceLanguages : [ "swift" ] ,
133
135
name : `Release ${ product . name } ${ nameSuffix } ` ,
134
- program : ` ${ buildDirectory } / release/` + product . name ,
136
+ program : path . join ( buildDirectory , " release" , product . name + binaryExtension ) ,
135
137
args : [ ] ,
136
138
cwd : folder ,
137
139
preLaunchTask : `swift: Build Release ${ product . name } ${ nameSuffix } ` ,
@@ -159,7 +161,7 @@ export function createSnippetConfiguration(
159
161
request : "launch" ,
160
162
sourceLanguages : [ "swift" ] ,
161
163
name : `Run ${ snippetName } ` ,
162
- program : ` ${ buildDirectory } / debug/ ${ snippetName } ` ,
164
+ program : path . join ( buildDirectory , " debug" , snippetName ) ,
163
165
args : [ ] ,
164
166
cwd : folder ,
165
167
env : swiftRuntimeEnv ( true ) ,
@@ -235,7 +237,11 @@ export function createTestConfiguration(
235
237
request : "launch" ,
236
238
sourceLanguages : [ "swift" ] ,
237
239
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
+ ) ,
239
245
cwd : folder ,
240
246
env : testEnv ,
241
247
preRunCommands : preRunCommands ,
0 commit comments