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
7230f0b8
Commit
7230f0b8
authored
Jun 16, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure "remove" return a promise
parent
33622dde
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
fileProvider.js
src/app/files/fileProvider.js
+5
-3
remixDProvider.js
src/app/files/remixDProvider.js
+4
-1
No files found.
src/app/files/fileProvider.js
View file @
7230f0b8
...
@@ -157,12 +157,13 @@ class FileProvider {
...
@@ -157,12 +157,13 @@ class FileProvider {
* @param {*} path is the folder to be removed
* @param {*} path is the folder to be removed
*/
*/
remove
(
path
)
{
remove
(
path
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
path
=
this
.
removePrefix
(
path
)
path
=
this
.
removePrefix
(
path
)
if
(
window
.
remixFileSystem
.
existsSync
(
path
))
{
if
(
window
.
remixFileSystem
.
existsSync
(
path
))
{
const
stat
=
window
.
remixFileSystem
.
statSync
(
path
)
const
stat
=
window
.
remixFileSystem
.
statSync
(
path
)
try
{
try
{
if
(
!
stat
.
isDirectory
())
{
if
(
!
stat
.
isDirectory
())
{
return
this
.
removeFile
(
path
)
resolve
(
this
.
removeFile
(
path
)
)
}
else
{
}
else
{
const
items
=
window
.
remixFileSystem
.
readdirSync
(
path
)
const
items
=
window
.
remixFileSystem
.
readdirSync
(
path
)
if
(
items
.
length
!==
0
)
{
if
(
items
.
length
!==
0
)
{
...
@@ -182,10 +183,11 @@ class FileProvider {
...
@@ -182,10 +183,11 @@ class FileProvider {
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
return
false
return
resolve
(
false
)
}
}
}
}
return
true
return
resolve
(
true
)
})
}
}
removeFile
(
path
)
{
removeFile
(
path
)
{
...
...
src/app/files/remixDProvider.js
View file @
7230f0b8
...
@@ -130,19 +130,22 @@ module.exports = class RemixDProvider {
...
@@ -130,19 +130,22 @@ module.exports = class RemixDProvider {
}
}
remove
(
path
)
{
remove
(
path
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
this
.
_appManager
.
call
(
'remixd'
,
'remove'
,
{
path
:
unprefixedpath
})
this
.
_appManager
.
call
(
'remixd'
,
'remove'
,
{
path
:
unprefixedpath
})
.
then
(
result
=>
{
.
then
(
result
=>
{
console
.
log
(
'result: '
,
result
)
console
.
log
(
'result: '
,
result
)
const
path
=
this
.
type
+
'/'
+
unprefixedpath
const
path
=
this
.
type
+
'/'
+
unprefixedpath
delete
this
.
filesContent
[
path
]
delete
this
.
filesContent
[
path
]
resolve
(
true
)
this
.
init
(()
=>
{
this
.
init
(()
=>
{
this
.
event
.
trigger
(
'fileRemoved'
,
[
path
])
this
.
event
.
trigger
(
'fileRemoved'
,
[
path
])
})
})
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
if
(
error
)
console
.
log
(
error
)
if
(
error
)
console
.
log
(
error
)
resolve
(
false
)
})
})
})
}
}
...
...
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