Skip to content

Commit dfc3a4c

Browse files
committed
Makes it work for Windows
1 parent 4b6ac40 commit dfc3a4c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/getScriptFile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const token = require('./token.js');
1111
* @param {Function} callback Callback function that receives a result.
1212
*/
1313
function getScriptFile(callback) {
14+
1415
const settings = ide.config.get();
1516
if (ide.editor.isDirty() && settings.saveFileBeforeExecution) {
1617
ide.editor.save();
@@ -33,7 +34,7 @@ module.exports = getScriptFile;
3334

3435

3536
function getScriptFileFromConfig() {
36-
let workspacePath = process.env.PWD;
37+
let workspacePath = path.parse(process.cwd()).root;
3738

3839
const workspaceFolder = ide.config.getWorkspaceFolder();
3940
if (workspaceFolder) {
@@ -66,13 +67,14 @@ function getScriptFileFromEditor() {
6667

6768
function getScriptFileFromToken() {
6869
let scriptFile = ide.editor.ensereHasPath();
70+
const rootDir = path.parse(scriptFile).root;
6971
let scriptFolder = path.dirname(scriptFile);
70-
72+
7173
let tokenPath = token.getPath();
7274
tokenPath = file.untildify(tokenPath);
7375

7476
let targetFile;
75-
while (scriptFolder !== process.env.PWD) {
77+
while (scriptFolder !== rootDir) {
7678
targetFile = path.join(scriptFolder, tokenPath);
7779
targetFile = path.resolve(targetFile);
7880

0 commit comments

Comments
 (0)