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
d46dd132
Commit
d46dd132
authored
Jun 24, 2020
by
yann300
Committed by
ioedeveloper
Jul 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make call only if provider ready
parent
ef7d5f4b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
remixDProvider.js
apps/remix-ide/src/app/files/remixDProvider.js
+8
-3
No files found.
apps/remix-ide/src/app/files/remixDProvider.js
View file @
d46dd132
...
@@ -66,6 +66,7 @@ module.exports = class RemixDProvider {
...
@@ -66,6 +66,7 @@ module.exports = class RemixDProvider {
}
}
exists
(
path
,
cb
)
{
exists
(
path
,
cb
)
{
if
(
!
this
.
_isReady
)
return
cb
&&
cb
(
'provider not ready'
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
return
this
.
_appManager
.
call
(
'remixd'
,
'exists'
,
{
path
:
unprefixedpath
})
return
this
.
_appManager
.
call
(
'remixd'
,
'exists'
,
{
path
:
unprefixedpath
})
...
@@ -87,6 +88,7 @@ module.exports = class RemixDProvider {
...
@@ -87,6 +88,7 @@ module.exports = class RemixDProvider {
}
}
get
(
path
,
cb
)
{
get
(
path
,
cb
)
{
if
(
!
this
.
_isReady
)
return
cb
&&
cb
(
'provider not ready'
)
var
unprefixedpath
=
this
.
removePrefix
(
path
)
var
unprefixedpath
=
this
.
removePrefix
(
path
)
this
.
_appManager
.
call
(
'remixd'
,
'get'
,
{
path
:
unprefixedpath
})
this
.
_appManager
.
call
(
'remixd'
,
'get'
,
{
path
:
unprefixedpath
})
.
then
((
file
)
=>
{
.
then
((
file
)
=>
{
...
@@ -102,6 +104,7 @@ module.exports = class RemixDProvider {
...
@@ -102,6 +104,7 @@ module.exports = class RemixDProvider {
}
}
async
set
(
path
,
content
,
cb
)
{
async
set
(
path
,
content
,
cb
)
{
if
(
!
this
.
_isReady
)
return
cb
&&
cb
(
'provider not ready'
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
return
this
.
_appManager
.
call
(
'remixd'
,
'set'
,
{
path
:
unprefixedpath
,
content
:
content
}).
then
(
async
(
result
)
=>
{
return
this
.
_appManager
.
call
(
'remixd'
,
'set'
,
{
path
:
unprefixedpath
,
content
:
content
}).
then
(
async
(
result
)
=>
{
...
@@ -118,6 +121,7 @@ module.exports = class RemixDProvider {
...
@@ -118,6 +121,7 @@ module.exports = class RemixDProvider {
remove
(
path
)
{
remove
(
path
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
this
.
_isReady
)
return
reject
(
'provider not ready'
)
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
=>
{
...
@@ -136,7 +140,7 @@ module.exports = class RemixDProvider {
...
@@ -136,7 +140,7 @@ module.exports = class RemixDProvider {
rename
(
oldPath
,
newPath
,
isFolder
)
{
rename
(
oldPath
,
newPath
,
isFolder
)
{
const
unprefixedoldPath
=
this
.
removePrefix
(
oldPath
)
const
unprefixedoldPath
=
this
.
removePrefix
(
oldPath
)
const
unprefixednewPath
=
this
.
removePrefix
(
newPath
)
const
unprefixednewPath
=
this
.
removePrefix
(
newPath
)
if
(
!
this
.
_isReady
)
return
new
Promise
((
resolve
,
reject
)
=>
reject
(
'provider not ready'
))
return
this
.
_appManager
.
call
(
'remixd'
,
'rename'
,
{
oldPath
:
unprefixedoldPath
,
newPath
:
unprefixednewPath
})
return
this
.
_appManager
.
call
(
'remixd'
,
'rename'
,
{
oldPath
:
unprefixedoldPath
,
newPath
:
unprefixednewPath
})
.
then
(
result
=>
{
.
then
(
result
=>
{
const
newPath
=
this
.
type
+
'/'
+
unprefixednewPath
const
newPath
=
this
.
type
+
'/'
+
unprefixednewPath
...
@@ -177,6 +181,7 @@ module.exports = class RemixDProvider {
...
@@ -177,6 +181,7 @@ module.exports = class RemixDProvider {
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
if
(
!
this
.
_isReady
)
return
callback
&&
callback
(
'provider not ready'
)
this
.
_appManager
.
call
(
'remixd'
,
'resolveDirectory'
,
{
path
:
unprefixedpath
}).
then
((
result
)
=>
{
this
.
_appManager
.
call
(
'remixd'
,
'resolveDirectory'
,
{
path
:
unprefixedpath
}).
then
((
result
)
=>
{
callback
(
null
,
result
)
callback
(
null
,
result
)
}).
catch
(
callback
)
}).
catch
(
callback
)
...
@@ -184,13 +189,13 @@ module.exports = class RemixDProvider {
...
@@ -184,13 +189,13 @@ module.exports = class RemixDProvider {
async
isDirectory
(
path
)
{
async
isDirectory
(
path
)
{
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
if
(
!
this
.
_isReady
)
throw
new
Error
(
'provider not ready'
)
return
await
this
.
_appManager
.
call
(
'remixd'
,
'isDirectory'
,
{
path
:
unprefixedpath
})
return
await
this
.
_appManager
.
call
(
'remixd'
,
'isDirectory'
,
{
path
:
unprefixedpath
})
}
}
async
isFile
(
path
)
{
async
isFile
(
path
)
{
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
unprefixedpath
=
this
.
removePrefix
(
path
)
if
(
!
this
.
_isReady
)
throw
new
Error
(
'provider not ready'
)
return
await
this
.
_appManager
.
call
(
'remixd'
,
'isFile'
,
{
path
:
unprefixedpath
})
return
await
this
.
_appManager
.
call
(
'remixd'
,
'isFile'
,
{
path
:
unprefixedpath
})
}
}
}
}
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