Skip to content

Commit

Permalink
Added windows support for extension (#1)
Browse files Browse the repository at this point in the history
* Added support for windows
  • Loading branch information
varunvd authored Dec 29, 2022
1 parent a7ba976 commit 2f78a0f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/executeCurrentFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,27 @@ class ExecuteCurrentFile {
}

getLama2Command() {
let randomNameFile = null
let randomNameFlag = null
let cmd = null
let windowsBasePath = "C:\\ProgramData\\.lama2"
let randomNameBase = this.generateRandomName(8)
let randomNameFlag = `/tmp/${randomNameBase}.flag`
let randomNameFile = `/tmp/${randomNameBase}.json`
let currentFilePath = vscode.window.activeTextEditor?.document.fileName

if (process.platform === "win32") {
if (!fs.existsSync(windowsBasePath)) {
fs.mkdirSync(windowsBasePath)
}
randomNameFlag = `${windowsBasePath}\\${randomNameBase}.flag`
randomNameFile = `${windowsBasePath}\\${randomNameBase}.json`
cmd = `powershell l2 -n -o ${randomNameFile} ${currentFilePath}; New-Item -Path ${randomNameFlag}`
}else {
randomNameFlag = `/tmp/${randomNameBase}.flag`
randomNameFile = `/tmp/${randomNameBase}.json`
cmd = `l2 -n -o ${randomNameFile} ${currentFilePath}; touch ${randomNameFlag}`
}
return {
"cmd": `l2 -n -o ${randomNameFile} ${currentFilePath}; touch ${randomNameFlag}`,
"cmd": cmd,
"rflag": randomNameFlag,
"rfile": randomNameFile
}
Expand Down

0 comments on commit 2f78a0f

Please sign in to comment.