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
3225df07
Commit
3225df07
authored
Jun 19, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listen to folder added event
parent
e31aa601
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
file-explorer.js
apps/remix-ide/src/app/files/file-explorer.js
+0
-3
remixDProvider.js
apps/remix-ide/src/app/files/remixDProvider.js
+7
-12
No files found.
apps/remix-ide/src/app/files/file-explorer.js
View file @
3225df07
...
...
@@ -130,11 +130,8 @@ function fileExplorer (localRegistry, files, menuItems) {
function
folderAdded
(
folderpath
)
{
self
.
ensureRoot
(()
=>
{
console
.
log
(
'called: ensureRoot'
)
folderpath
=
folderpath
.
split
(
'/'
).
slice
(
0
,
-
1
).
join
(
'/'
)
console
.
log
(
'folderpath: '
,
folderpath
)
self
.
files
.
resolveDirectory
(
folderpath
,
(
error
,
fileTree
)
=>
{
console
.
log
(
'fileTree: '
,
fileTree
)
if
(
error
)
console
.
error
(
error
)
if
(
!
fileTree
)
return
fileTree
=
normalize
(
folderpath
,
fileTree
)
...
...
apps/remix-ide/src/app/files/remixDProvider.js
View file @
3225df07
...
...
@@ -22,6 +22,11 @@ module.exports = class RemixDProvider {
})
})
this
.
_appManager
.
on
(
'remixd'
,
'folderAdded'
,
(
path
)
=>
{
console
.
log
(
'event listener called'
)
this
.
event
.
trigger
(
'folderAdded'
,
[
path
])
})
this
.
_appManager
.
on
(
'remixd'
,
'notified'
,
(
data
)
=>
{
if
(
data
.
scope
===
'sharedfolder'
)
{
if
(
data
.
name
===
'created'
)
{
...
...
@@ -110,21 +115,12 @@ module.exports = class RemixDProvider {
async
set
(
path
,
content
,
cb
)
{
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
exists
=
await
this
.
exists
(
path
)
return
this
.
_appManager
.
call
(
'remixd'
,
'set'
,
{
path
:
unprefixedpath
,
content
:
content
}).
then
(
async
(
result
)
=>
{
if
(
cb
)
return
cb
(
null
,
result
)
const
path
=
this
.
type
+
'/'
+
unprefixedpath
if
(
!
exists
)
{
const
isDirectory
=
await
this
.
isDirectory
(
path
)
if
(
isDirectory
)
this
.
event
.
trigger
(
'folderAdded'
,
[
path
])
else
this
.
event
.
trigger
(
'fileAdded'
,
[
path
])
}
else
{
this
.
event
.
trigger
(
'fileChanged'
,
[
path
])
}
if
(
cb
)
return
cb
(
null
,
result
)
this
.
event
.
trigger
(
'fileChanged'
,
[
path
])
}).
catch
((
error
)
=>
{
if
(
cb
)
return
cb
(
error
)
throw
new
Error
(
error
)
...
...
@@ -192,7 +188,6 @@ module.exports = class RemixDProvider {
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
const
unprefixedpath
=
this
.
removePrefix
(
path
)
this
.
_appManager
.
call
(
'remixd'
,
'resolveDirectory'
,
{
path
:
unprefixedpath
}).
then
((
result
)
=>
{
console
.
log
(
'result: '
,
result
)
callback
(
null
,
result
)
}).
catch
(
callback
)
}
...
...
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