Skip to content

Commit aeff252

Browse files
authored
Merge pull request #839 from ethereum/bump-remixd
Fixed remixd for windows
2 parents 021e7e2 + c7e746e commit aeff252

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

libs/remixd/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@remix-project/remixd",
3-
"version": "0.3.0",
3+
"version": "0.3.2",
44
"description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)",
55
"main": "index.js",
66
"types": "./index.d.ts",

libs/remixd/src/utils.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ function relativePath (path: string, sharedFolder: string): string {
2929
}
3030

3131
function normalizePath (path: string): string {
32+
if (path === '/') path = './'
3233
if (process.platform === 'win32') {
3334
return path.replace(/\\/g, '/')
3435
}
35-
if (path === '/') path = './'
3636
return path
3737
}
3838

@@ -42,8 +42,15 @@ function walkSync (dir: string, filelist: Filelist, sharedFolder: string): Filel
4242
filelist = filelist || {}
4343
files.forEach(function (file) {
4444
const subElement = pathModule.join(dir, file)
45+
let isSymbolicLink
4546

46-
if (!fs.lstatSync(subElement).isSymbolicLink()) {
47+
try {
48+
isSymbolicLink = !fs.lstatSync(subElement).isSymbolicLink()
49+
} catch (error) {
50+
isSymbolicLink = false
51+
}
52+
53+
if (isSymbolicLink) {
4754
if (fs.statSync(subElement).isDirectory()) {
4855
filelist = walkSync(subElement, filelist, sharedFolder)
4956
} else {
@@ -62,8 +69,14 @@ function resolveDirectory (dir: string, sharedFolder: string): ResolveDirectory
6269

6370
files.forEach(function (file) {
6471
const subElement = pathModule.join(dir, file)
72+
let isSymbolicLink
6573

66-
if (!fs.lstatSync(subElement).isSymbolicLink()) {
74+
try {
75+
isSymbolicLink = !fs.lstatSync(subElement).isSymbolicLink()
76+
} catch (error) {
77+
isSymbolicLink = false
78+
}
79+
if (isSymbolicLink) {
6780
const relative: string = relativePath(subElement, sharedFolder)
6881

6982
ret[relative] = { isDirectory: fs.statSync(subElement).isDirectory() }

0 commit comments

Comments
 (0)