Skip to content

Commit

Permalink
Strip windows paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
We-Gold committed Aug 2, 2024
1 parent 0e40b8c commit 4bef483
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/event-handlers/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export const addFSEventHandlers = (ipcMain: IpcMain, getMainWindow: () => Browse
isDirectory = stats.isDirectory()
}

const relativePath = targetPath.replace(folderPath, '').replace(/^\//, '')
const relativePath = targetPath.replace(folderPath, '').replace(/^[\/\\]/, '')

let relativePathNext = ''
if (targetPathNext) {
relativePathNext = targetPathNext.replace(folderPath, '').replace(/^\//, '')
relativePathNext = targetPathNext.replace(folderPath, '').replace(/^[\/\\]/, '')
}

// Make sure the path is not the root folder
if (relativePath === '') return
if (relativePath === '' || relativePath.length === 0) return

// Split the path by the separator
const pathParts = relativePath.split(sep)
Expand Down

0 comments on commit 4bef483

Please sign in to comment.