From daaba514fb37b3182e5933ebc5151e3731091914 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 4 Feb 2021 13:16:32 +0100 Subject: [PATCH] Fixed remixd for windows --- libs/remixd/package.json | 4 ++-- libs/remixd/src/utils.ts | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libs/remixd/package.json b/libs/remixd/package.json index 822e250976..8459cc3ed9 100644 --- a/libs/remixd/package.json +++ b/libs/remixd/package.json @@ -1,6 +1,6 @@ { "name": "@remix-project/remixd", - "version": "0.3.0", + "version": "0.3.1", "description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)", "main": "index.js", "types": "./index.d.ts", @@ -40,7 +40,7 @@ "@remixproject/plugin-utils": "^0.3.3", "@remixproject/plugin-ws": "^0.3.3", "axios": "^0.20.0", - "chokidar": "^2.1.8", + "chokidar": "^3.5.1", "commander": "^2.20.3", "fs-extra": "^3.0.1", "isbinaryfile": "^3.0.2", diff --git a/libs/remixd/src/utils.ts b/libs/remixd/src/utils.ts index cfef199e34..984f6de798 100644 --- a/libs/remixd/src/utils.ts +++ b/libs/remixd/src/utils.ts @@ -42,8 +42,15 @@ function walkSync (dir: string, filelist: Filelist, sharedFolder: string): Filel filelist = filelist || {} files.forEach(function (file) { const subElement = pathModule.join(dir, file) + let isSymbolicLink - if (!fs.lstatSync(subElement).isSymbolicLink()) { + try { + isSymbolicLink = !fs.lstatSync(subElement).isSymbolicLink() + } catch (error) { + isSymbolicLink = false + } + + if (isSymbolicLink) { if (fs.statSync(subElement).isDirectory()) { filelist = walkSync(subElement, filelist, sharedFolder) } else { @@ -62,8 +69,14 @@ function resolveDirectory (dir: string, sharedFolder: string): ResolveDirectory files.forEach(function (file) { const subElement = pathModule.join(dir, file) + let isSymbolicLink - if (!fs.lstatSync(subElement).isSymbolicLink()) { + try { + isSymbolicLink = !fs.lstatSync(subElement).isSymbolicLink() + } catch (error) { + isSymbolicLink = false + } + if (isSymbolicLink) { const relative: string = relativePath(subElement, sharedFolder) ret[relative] = { isDirectory: fs.statSync(subElement).isDirectory() }