diff --git a/src/Helper.ts b/src/Helper.ts index df57aa3a..c2d022e7 100644 --- a/src/Helper.ts +++ b/src/Helper.ts @@ -8,6 +8,13 @@ export const SUPPRORTED_EXT: string[] = [ '.html', '.htm', '.svg' ]; +export const isRelativePath = (pathUrl: string) => { + if (pathUrl.startsWith('*')) return false; + + return !path.isAbsolute(pathUrl); +} + + export class Helper { @@ -23,7 +30,7 @@ export class Helper { rootPath = testPath; } else { - rootPath = workSpacePath; + rootPath = workSpacePath; } if (!rootPath.endsWith(path.sep)) @@ -80,8 +87,9 @@ export class Helper { const ignoreFiles = []; ignorePathGlob.forEach(ignoredPath => { - if (!ignoredPath.startsWith('/') || !ignoredPath.startsWith('\\')) - ignoreFiles.push(workspacePath + path.sep + ignoredPath); + if (isRelativePath(ignoredPath)) + ignoreFiles.push(path.join(workspacePath, ignoredPath)); + else ignoreFiles.push(ignoredPath); }); const proxy = Helper.getProxySetup(); diff --git a/src/extension.ts b/src/extension.ts index 4ab6a106..987d3e59 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -9,10 +9,9 @@ export function activate(context: ExtensionContext) { checkNewAnnouncement(context.globalState); context.subscriptions.push(commands - .registerCommand('extension.liveServer.goOnline', (fileUri) => { - workspace.saveAll().then(() => { - appModel.Golive(fileUri ? fileUri.fsPath : null); - }); + .registerCommand('extension.liveServer.goOnline', async (fileUri) => { + await workspace.saveAll(); + appModel.Golive(fileUri ? fileUri.fsPath : null); }) );