Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
4419de25
Unverified
Commit
4419de25
authored
Dec 14, 2017
by
yann300
Committed by
GitHub
Dec 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11 from ethereum/startnode
add resolveDirectory & change sharedfolder `get` return value
parents
8719ce86
4cbe4c17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
sharedFolder.js
src/services/sharedFolder.js
+10
-1
utils.js
src/utils.js
+15
-1
No files found.
src/services/sharedFolder.js
View file @
4419de25
...
...
@@ -15,6 +15,15 @@ module.exports = {
cb
(
null
,
utils
.
walkSync
(
this
.
sharedFolder
,
{},
this
.
sharedFolder
))
},
resolveDirectory
:
function
(
args
,
cb
)
{
try
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
cb
(
null
,
utils
.
resolveDirectory
(
path
,
this
.
sharedFolder
))
}
catch
(
e
)
{
cb
(
e
)
}
},
get
:
function
(
args
,
cb
)
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
if
(
!
isRealPath
(
path
,
cb
))
return
...
...
@@ -25,7 +34,7 @@ module.exports = {
}
else
{
fs
.
readFile
(
path
,
'utf8'
,
(
error
,
data
)
=>
{
if
(
error
)
console
.
log
(
error
)
cb
(
error
,
data
)
cb
(
error
,
{
content
:
data
,
readonly
:
false
}
)
})
}
})
...
...
src/utils.js
View file @
4419de25
...
...
@@ -6,7 +6,8 @@ var pathModule = require('path')
module
.
exports
=
{
absolutePath
:
absolutePath
,
relativePath
:
relativePath
,
walkSync
:
walkSync
walkSync
:
walkSync
,
resolveDirectory
:
resolveDirectory
}
/**
...
...
@@ -59,3 +60,16 @@ function walkSync (dir, filelist, sharedFolder) {
})
return
filelist
}
function
resolveDirectory
(
dir
,
sharedFolder
)
{
var
ret
=
{}
var
files
=
fs
.
readdirSync
(
dir
)
files
.
forEach
(
function
(
file
)
{
var
subElement
=
path
.
join
(
dir
,
file
)
if
(
!
fs
.
lstatSync
(
subElement
).
isSymbolicLink
())
{
var
relative
=
relativePath
(
subElement
,
sharedFolder
)
ret
[
relative
]
=
{
isDirectory
:
fs
.
statSync
(
subElement
).
isDirectory
()
}
}
})
return
ret
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment