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
efcfd5d3
Unverified
Commit
efcfd5d3
authored
Apr 08, 2021
by
yann300
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return after reject (#1093)
fix
https://github.com/ethereum/remix-project/issues/1075
parent
fe6d057d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
remixdClient.ts
libs/remixd/src/services/remixdClient.ts
+12
-12
No files found.
libs/remixd/src/services/remixdClient.ts
View file @
efcfd5d3
...
@@ -88,15 +88,15 @@ export class RemixdClient extends PluginClient {
...
@@ -88,15 +88,15 @@ export class RemixdClient extends PluginClient {
set
(
args
:
SharedFolderArgs
):
Promise
<
void
>
{
set
(
args
:
SharedFolderArgs
):
Promise
<
void
>
{
try
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
readOnly
)
reject
(
new
Error
(
'Cannot write file: read-only mode selected'
))
if
(
this
.
readOnly
)
re
turn
re
ject
(
new
Error
(
'Cannot write file: read-only mode selected'
))
const
isFolder
=
args
.
path
.
endsWith
(
'/'
)
const
isFolder
=
args
.
path
.
endsWith
(
'/'
)
const
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentSharedFolder
)
const
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentSharedFolder
)
const
exists
=
fs
.
existsSync
(
path
)
const
exists
=
fs
.
existsSync
(
path
)
if
(
exists
&&
!
isRealPath
(
path
))
reject
(
new
Error
(
''
))
if
(
exists
&&
!
isRealPath
(
path
))
re
turn
re
ject
(
new
Error
(
''
))
if
(
args
.
content
===
'undefined'
)
{
// no !!!!!
if
(
args
.
content
===
'undefined'
)
{
// no !!!!!
console
.
log
(
'trying to write "undefined" ! stopping.'
)
console
.
log
(
'trying to write "undefined" ! stopping.'
)
reject
(
new
Error
(
'trying to write "undefined" ! stopping.'
))
re
turn
re
ject
(
new
Error
(
'trying to write "undefined" ! stopping.'
))
}
}
this
.
trackDownStreamUpdate
[
path
]
=
path
this
.
trackDownStreamUpdate
[
path
]
=
path
if
(
isFolder
)
{
if
(
isFolder
)
{
...
@@ -114,7 +114,7 @@ export class RemixdClient extends PluginClient {
...
@@ -114,7 +114,7 @@ export class RemixdClient extends PluginClient {
fs
.
writeFile
(
path
,
args
.
content
,
'utf8'
,
(
error
:
Error
)
=>
{
fs
.
writeFile
(
path
,
args
.
content
,
'utf8'
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
reject
(
error
)
re
turn
re
ject
(
error
)
}
}
resolve
()
resolve
()
})
})
...
@@ -134,11 +134,11 @@ export class RemixdClient extends PluginClient {
...
@@ -134,11 +134,11 @@ export class RemixdClient extends PluginClient {
createDir
(
args
:
SharedFolderArgs
):
Promise
<
void
>
{
createDir
(
args
:
SharedFolderArgs
):
Promise
<
void
>
{
try
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
readOnly
)
reject
(
new
Error
(
'Cannot create folder: read-only mode selected'
))
if
(
this
.
readOnly
)
re
turn
re
ject
(
new
Error
(
'Cannot create folder: read-only mode selected'
))
const
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentSharedFolder
)
const
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentSharedFolder
)
const
exists
=
fs
.
existsSync
(
path
)
const
exists
=
fs
.
existsSync
(
path
)
if
(
exists
&&
!
isRealPath
(
path
))
reject
(
new
Error
(
''
))
if
(
exists
&&
!
isRealPath
(
path
))
re
turn
re
ject
(
new
Error
(
''
))
this
.
trackDownStreamUpdate
[
path
]
=
path
this
.
trackDownStreamUpdate
[
path
]
=
path
fs
.
mkdirp
(
path
).
then
(()
=>
{
fs
.
mkdirp
(
path
).
then
(()
=>
{
let
splitPath
=
args
.
path
.
split
(
'/'
)
let
splitPath
=
args
.
path
.
split
(
'/'
)
...
@@ -158,11 +158,11 @@ export class RemixdClient extends PluginClient {
...
@@ -158,11 +158,11 @@ export class RemixdClient extends PluginClient {
rename
(
args
:
SharedFolderArgs
):
Promise
<
boolean
>
{
rename
(
args
:
SharedFolderArgs
):
Promise
<
boolean
>
{
try
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
readOnly
)
reject
(
new
Error
(
'Cannot rename file: read-only mode selected'
))
if
(
this
.
readOnly
)
re
turn
re
ject
(
new
Error
(
'Cannot rename file: read-only mode selected'
))
const
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
currentSharedFolder
)
const
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
currentSharedFolder
)
if
(
!
fs
.
existsSync
(
oldpath
))
{
if
(
!
fs
.
existsSync
(
oldpath
))
{
reject
(
new
Error
(
'File not found '
+
oldpath
))
re
turn
re
ject
(
new
Error
(
'File not found '
+
oldpath
))
}
}
const
newpath
=
utils
.
absolutePath
(
args
.
newPath
,
this
.
currentSharedFolder
)
const
newpath
=
utils
.
absolutePath
(
args
.
newPath
,
this
.
currentSharedFolder
)
...
@@ -170,7 +170,7 @@ export class RemixdClient extends PluginClient {
...
@@ -170,7 +170,7 @@ export class RemixdClient extends PluginClient {
fs
.
move
(
oldpath
,
newpath
,
(
error
:
Error
)
=>
{
fs
.
move
(
oldpath
,
newpath
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
reject
(
error
.
message
)
re
turn
re
ject
(
error
.
message
)
}
}
this
.
emit
(
'fileRenamed'
,
args
.
oldPath
,
args
.
newPath
)
this
.
emit
(
'fileRenamed'
,
args
.
oldPath
,
args
.
newPath
)
resolve
(
true
)
resolve
(
true
)
...
@@ -184,15 +184,15 @@ export class RemixdClient extends PluginClient {
...
@@ -184,15 +184,15 @@ export class RemixdClient extends PluginClient {
remove
(
args
:
SharedFolderArgs
):
Promise
<
boolean
>
{
remove
(
args
:
SharedFolderArgs
):
Promise
<
boolean
>
{
try
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
readOnly
)
reject
(
new
Error
(
'Cannot remove file: read-only mode selected'
))
if
(
this
.
readOnly
)
re
turn
re
ject
(
new
Error
(
'Cannot remove file: read-only mode selected'
))
const
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentSharedFolder
)
const
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentSharedFolder
)
if
(
!
fs
.
existsSync
(
path
))
reject
(
new
Error
(
'File not found '
+
path
))
if
(
!
fs
.
existsSync
(
path
))
re
turn
re
ject
(
new
Error
(
'File not found '
+
path
))
if
(
!
isRealPath
(
path
))
return
if
(
!
isRealPath
(
path
))
return
return
fs
.
remove
(
path
,
(
error
:
Error
)
=>
{
return
fs
.
remove
(
path
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
reject
(
new
Error
(
'Failed to remove file/directory: '
+
error
))
re
turn
re
ject
(
new
Error
(
'Failed to remove file/directory: '
+
error
))
}
}
this
.
emit
(
'fileRemoved'
,
args
.
path
)
this
.
emit
(
'fileRemoved'
,
args
.
path
)
resolve
(
true
)
resolve
(
true
)
...
...
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