Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/remixd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remixd",
"version": "0.3.0",
"version": "0.3.2",
"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",
Expand Down
19 changes: 16 additions & 3 deletions libs/remixd/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function relativePath (path: string, sharedFolder: string): string {
}

function normalizePath (path: string): string {
if (path === '/') path = './'
if (process.platform === 'win32') {
return path.replace(/\\/g, '/')
}
if (path === '/') path = './'
return path
}

Expand All @@ -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 {
Expand All @@ -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() }
Expand Down