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
09bbcf54
Commit
09bbcf54
authored
Mar 09, 2017
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement files.listAsTree()
parent
ba5051fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
files.js
src/app/files.js
+41
-0
No files found.
src/app/files.js
View file @
09bbcf54
...
@@ -107,6 +107,47 @@ function Files (storage) {
...
@@ -107,6 +107,47 @@ function Files (storage) {
return
files
return
files
}
}
//
// Tree model for files
// {
// 'a': { }, // empty directory 'a'
// 'b': {
// 'c': {}, // empty directory 'b/c'
// 'd': { '/readonly': true, '/content': 'Hello World' } // files 'b/c/d'
// 'e': { '/readonly': false, '/path': 'b/c/d' } // symlink to 'b/c/d'
// 'f': { '/readonly': false, '/content': '<executable>', '/mode': 0755 }
// }
// }
//
this
.
listAsTree
=
function
()
{
function
hashmapize
(
obj
,
path
,
val
)
{
var
nodes
=
path
.
split
(
'/'
)
var
i
=
0
for
(;
i
<
nodes
.
length
-
1
;
i
++
)
{
var
node
=
nodes
[
i
]
if
(
obj
[
node
]
===
undefined
)
{
obj
[
node
]
=
{}
}
obj
=
obj
[
node
]
}
obj
[
nodes
[
i
]]
=
val
}
var
tree
=
{}
var
self
=
this
storage
.
keys
().
forEach
(
function
(
path
)
{
hashmapize
(
tree
,
path
,
{
'/readonly'
:
self
.
isReadOnly
(
path
),
'/content'
:
self
.
get
(
path
)
})
})
return
tree
}
// rename .browser-solidity.json to .remix.config
// rename .browser-solidity.json to .remix.config
if
(
this
.
exists
(
'.browser-solidity.json'
))
{
if
(
this
.
exists
(
'.browser-solidity.json'
))
{
this
.
rename
(
'.browser-solidity.json'
,
'.remix.config'
)
this
.
rename
(
'.browser-solidity.json'
,
'.remix.config'
)
...
...
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