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
fcec4fef
Commit
fcec4fef
authored
May 06, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed fileExplorer to async/await to fix remixd error
parent
12bc6297
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
file-explorer.js
src/app/files/file-explorer.js
+10
-5
fileManager.js
src/app/files/fileManager.js
+4
-4
remixDProvider.js
src/app/files/remixDProvider.js
+5
-2
No files found.
src/app/files/file-explorer.js
View file @
fcec4fef
...
...
@@ -234,8 +234,11 @@ function fileExplorer (localRegistry, files, menuItems) {
const
currentFoldername
=
extractNameFromKey
(
key
)
modalDialogCustom
.
confirm
(
`Confirm to delete folder`
,
`Are you sure you want to delete
${
currentFoldername
}
folder?`
,
()
=>
{
if
(
!
files
.
remove
(
key
))
{
async
()
=>
{
const
fileManager
=
self
.
_deps
.
fileManager
const
removeFolder
=
await
fileManager
.
rmdir
(
key
)
if
(
!
removeFolder
)
{
tooltip
(
`failed to remove
${
key
}
. Make sure the directory is empty before removing it.`
)
}
else
{
self
.
updatePath
(
'browser'
)
...
...
@@ -578,13 +581,15 @@ fileExplorer.prototype.createNewFile = function (parentFolder = 'browser') {
let
self
=
this
modalDialogCustom
.
prompt
(
'Create new file'
,
'File Name (e.g Untitled.sol)'
,
'Untitled.sol'
,
(
input
)
=>
{
if
(
!
input
)
input
=
'New file'
helper
.
createNonClashingName
(
parentFolder
+
'/'
+
input
,
self
.
files
,
(
error
,
newName
)
=>
{
helper
.
createNonClashingName
(
parentFolder
+
'/'
+
input
,
self
.
files
,
async
(
error
,
newName
)
=>
{
if
(
error
)
return
tooltip
(
'Failed to create file '
+
newName
+
' '
+
error
)
const
fileManager
=
self
.
_deps
.
fileManager
const
createFile
=
await
fileManager
.
writeFile
(
newName
,
''
)
if
(
!
self
.
files
.
set
(
newName
,
''
)
)
{
if
(
!
createFile
)
{
tooltip
(
'Failed to create file '
+
newName
)
}
else
{
self
.
_deps
.
fileManager
.
open
(
newName
)
await
fileManager
.
open
(
newName
)
if
(
newName
.
includes
(
'_test.sol'
))
{
self
.
events
.
trigger
(
'newTestFileCreated'
,
[
newName
])
}
...
...
src/app/files/fileManager.js
View file @
fcec4fef
...
...
@@ -158,9 +158,9 @@ class FileManager extends Plugin {
async
writeFile
(
path
,
data
)
{
if
(
await
this
.
exists
(
path
))
{
await
this
.
_handleIsFile
(
path
,
`Cannot write file
${
path
}
`
)
this
.
setFile
(
path
,
data
)
return
await
this
.
setFile
(
path
,
data
)
}
else
{
this
.
setFile
(
path
,
data
)
return
await
this
.
setFile
(
path
,
data
)
}
}
...
...
@@ -262,7 +262,7 @@ class FileManager extends Plugin {
const
provider
=
this
.
fileProviderOf
(
path
)
return
provider
.
remove
(
path
)
return
await
provider
.
remove
(
path
)
}
init
()
{
...
...
@@ -385,7 +385,7 @@ class FileManager extends Plugin {
`
,
''
,
{
time
:
3000
})
}
}
this
.
_setFileInternal
(
path
,
content
)
return
await
this
.
_setFileInternal
(
path
,
content
)
}
_setFileInternal
(
path
,
content
)
{
...
...
src/app/files/remixDProvider.js
View file @
fcec4fef
...
...
@@ -118,9 +118,9 @@ module.exports = class RemixDProvider {
return
this
.
_readOnlyMode
||
this
.
_readOnlyFiles
[
path
]
===
1
}
remove
(
path
)
{
async
remove
(
path
)
{
var
unprefixedpath
=
this
.
removePrefix
(
path
)
this
.
_remixd
.
call
(
'sharedfolder'
,
'remove'
,
{
path
:
unprefixedpath
},
(
error
,
result
)
=>
{
const
callId
=
await
this
.
_remixd
.
call
(
'sharedfolder'
,
'remove'
,
{
path
:
unprefixedpath
},
(
error
,
result
)
=>
{
if
(
error
)
console
.
log
(
error
)
var
path
=
this
.
type
+
'/'
+
unprefixedpath
delete
this
.
filesContent
[
path
]
...
...
@@ -128,6 +128,9 @@ module.exports = class RemixDProvider {
this
.
event
.
trigger
(
'fileRemoved'
,
[
path
])
})
})
await
this
.
_remixd
.
receiveResponse
(
callId
)
return
true
}
rename
(
oldPath
,
newPath
,
isFolder
)
{
...
...
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