From eeabfab71b542c7afdab305aed2efdc9f62b8dcd Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Thu, 19 Nov 2020 05:24:40 -0300 Subject: [PATCH] Fixing file path issue to run on Windows The source file name is now extracted from editor.getPath() since, eventually, Atom adds othe informational text to the title, so, it was unsafe to use the window title to infer the file name. All backslashes '\\' characters are replaced by forward slashes prior to split the file path and name, this allow the plugin to properly deal with paths in Windows. --- lib/generator/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/generator/index.js b/lib/generator/index.js index 68f7e44..1ab186e 100644 --- a/lib/generator/index.js +++ b/lib/generator/index.js @@ -69,8 +69,9 @@ export const generateTestFile = (editor = {}) => { // user settings const { testDirName, testSufix, typeSystem } = getUserSettings(); // file info: Name, path - const srcFileName = getFileName(editor.getTitle()); // fileName without extension - const filePath = getFilePath(editor.getPath(), "/"); // The dir the file is located + const auxPathName = editor.getPath().replace(/\\/g, "/"); + const srcFileName = getFileName(auxPathName); // fileName without extension + const filePath = getFilePath(auxPathName); // The dir the file is located // generated test info: testFileName, saveLocation for test const testFileName = `${srcFileName}${testSufix}.js`;