|
|
@ -126,11 +126,12 @@ class FSPluginClient extends ElectronBasePluginClient { |
|
|
|
|
|
|
|
|
|
|
|
async glob(path: string, pattern: string, options?: GlobOptions): Promise<string[] | Path[]> { |
|
|
|
async glob(path: string, pattern: string, options?: GlobOptions): Promise<string[] | Path[]> { |
|
|
|
|
|
|
|
|
|
|
|
path = this.fixPath(path) |
|
|
|
path = convertPathToPosix(this.fixPath(path)) |
|
|
|
const files = await glob(path + pattern, { |
|
|
|
const files = await glob(path + pattern, { |
|
|
|
withFileTypes: true, |
|
|
|
withFileTypes: true, |
|
|
|
...options |
|
|
|
...options |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const result: any[] = [] |
|
|
|
const result: any[] = [] |
|
|
|
|
|
|
|
|
|
|
|
for (const file of files) { |
|
|
|
for (const file of files) { |
|
|
@ -141,6 +142,9 @@ class FSPluginClient extends ElectronBasePluginClient { |
|
|
|
if (pathWithoutWorkingDir.startsWith('/')) { |
|
|
|
if (pathWithoutWorkingDir.startsWith('/')) { |
|
|
|
pathWithoutWorkingDir = pathWithoutWorkingDir.slice(1) |
|
|
|
pathWithoutWorkingDir = pathWithoutWorkingDir.slice(1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(pathWithoutWorkingDir.startsWith('\\')) { |
|
|
|
|
|
|
|
pathWithoutWorkingDir = pathWithoutWorkingDir.slice(1) |
|
|
|
|
|
|
|
} |
|
|
|
result.push({ |
|
|
|
result.push({ |
|
|
|
path: pathWithoutWorkingDir + (file as Path).name, |
|
|
|
path: pathWithoutWorkingDir + (file as Path).name, |
|
|
|
isDirectory: (file as Path).isDirectory(), |
|
|
|
isDirectory: (file as Path).isDirectory(), |
|
|
@ -225,11 +229,11 @@ class FSPluginClient extends ElectronBasePluginClient { |
|
|
|
ignorePermissionErrors: true, ignoreInitial: true, |
|
|
|
ignorePermissionErrors: true, ignoreInitial: true, |
|
|
|
ignored: [ |
|
|
|
ignored: [ |
|
|
|
'**/node_modules/**', |
|
|
|
'**/node_modules/**', |
|
|
|
|
|
|
|
'**/.git/index.lock', // this file is created and unlinked all the time when git is running on Windows
|
|
|
|
] |
|
|
|
] |
|
|
|
}).on('all', async (eventName, path, stats) => { |
|
|
|
}).on('all', async (eventName, path, stats) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let pathWithoutPrefix = path.replace(this.workingDir, '') |
|
|
|
let pathWithoutPrefix = path.replace(this.workingDir, '') |
|
|
|
pathWithoutPrefix = convertPathToPosix(pathWithoutPrefix) |
|
|
|
pathWithoutPrefix = convertPathToPosix(pathWithoutPrefix) |
|
|
|
if (pathWithoutPrefix.startsWith('/')) pathWithoutPrefix = pathWithoutPrefix.slice(1) |
|
|
|
if (pathWithoutPrefix.startsWith('/')) pathWithoutPrefix = pathWithoutPrefix.slice(1) |
|
|
@ -242,7 +246,6 @@ class FSPluginClient extends ElectronBasePluginClient { |
|
|
|
|
|
|
|
|
|
|
|
if (currentContent !== newContent) { |
|
|
|
if (currentContent !== newContent) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
this.emit('change', eventName, pathWithoutPrefix) |
|
|
|
this.emit('change', eventName, pathWithoutPrefix) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.log('error emitting change', e) |
|
|
|
console.log('error emitting change', e) |
|
|
|