From a87eb4894acb32fa94390b17c89c8b159f300d5e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 26 Jan 2018 17:57:41 +0100 Subject: [PATCH] Fix issue on Windows --- build/lib/asar.js | 6 ++++++ build/lib/asar.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/lib/asar.js b/build/lib/asar.js index 85c63a4073e1b..cd961e2a6de38 100644 --- a/build/lib/asar.js +++ b/build/lib/asar.js @@ -31,6 +31,9 @@ function createAsar(folderPath, unpackGlobs, destFilename) { return; } var lastSlash = dir.lastIndexOf('/'); + if (lastSlash === -1) { + lastSlash = dir.lastIndexOf('\\'); + } if (lastSlash !== -1) { insertDirectoryRecursive(dir.substring(0, lastSlash)); } @@ -39,6 +42,9 @@ function createAsar(folderPath, unpackGlobs, destFilename) { }; var insertDirectoryForFile = function (file) { var lastSlash = file.lastIndexOf('/'); + if (lastSlash === -1) { + lastSlash = file.lastIndexOf('\\'); + } if (lastSlash !== -1) { insertDirectoryRecursive(file.substring(0, lastSlash)); } diff --git a/build/lib/asar.ts b/build/lib/asar.ts index e801225503cc0..c4a93a3e53333 100644 --- a/build/lib/asar.ts +++ b/build/lib/asar.ts @@ -37,7 +37,10 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena return; } - const lastSlash = dir.lastIndexOf('/'); + let lastSlash = dir.lastIndexOf('/'); + if (lastSlash === -1) { + lastSlash = dir.lastIndexOf('\\'); + } if (lastSlash !== -1) { insertDirectoryRecursive(dir.substring(0, lastSlash)); } @@ -46,7 +49,10 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena }; const insertDirectoryForFile = (file: string) => { - const lastSlash = file.lastIndexOf('/'); + let lastSlash = file.lastIndexOf('/'); + if (lastSlash === -1) { + lastSlash = file.lastIndexOf('\\'); + } if (lastSlash !== -1) { insertDirectoryRecursive(file.substring(0, lastSlash)); }