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
1a17fbd0
Unverified
Commit
1a17fbd0
authored
Jun 22, 2020
by
yann300
Committed by
GitHub
Jun 22, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #112 from ethereum/remixd-websocket
Emit Shared Folder Events
parents
80ab3520
80c800e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
remixdClient.ts
src/services/remixdClient.ts
+18
-2
No files found.
src/services/remixdClient.ts
View file @
1a17fbd0
...
@@ -86,15 +86,24 @@ export class RemixdClient extends PluginClient {
...
@@ -86,15 +86,24 @@ export class RemixdClient extends PluginClient {
if
(
this
.
readOnly
)
reject
(
'Cannot write file: read-only mode selected'
)
if
(
this
.
readOnly
)
reject
(
'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
)
if
(
fs
.
existsSync
(
path
)
&&
!
isRealPath
(
path
))
reject
()
if
(
exists
&&
!
isRealPath
(
path
))
reject
()
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
(
'trying to write "undefined" ! stopping.'
)
reject
(
'trying to write "undefined" ! stopping.'
)
}
}
this
.
trackDownStreamUpdate
[
path
]
=
path
this
.
trackDownStreamUpdate
[
path
]
=
path
if
(
isFolder
)
{
if
(
isFolder
)
{
fs
.
mkdirp
(
path
).
then
(()
=>
resolve
()).
catch
((
e
:
Error
)
=>
reject
(
e
))
fs
.
mkdirp
(
path
).
then
(()
=>
{
let
splitPath
=
args
.
path
.
split
(
'/'
)
splitPath
=
splitPath
.
filter
(
dir
=>
dir
)
const
dir
=
'/'
+
splitPath
.
join
(
'/'
)
this
.
emit
(
'folderAdded'
,
dir
)
resolve
()
}).
catch
((
e
:
Error
)
=>
reject
(
e
))
}
else
{
}
else
{
fs
.
ensureFile
(
path
).
then
(()
=>
{
fs
.
ensureFile
(
path
).
then
(()
=>
{
fs
.
writeFile
(
path
,
args
.
content
,
'utf8'
,
(
error
:
Error
)
=>
{
fs
.
writeFile
(
path
,
args
.
content
,
'utf8'
,
(
error
:
Error
)
=>
{
...
@@ -105,6 +114,11 @@ export class RemixdClient extends PluginClient {
...
@@ -105,6 +114,11 @@ export class RemixdClient extends PluginClient {
resolve
()
resolve
()
})
})
}).
catch
((
e
:
Error
)
=>
reject
(
e
))
}).
catch
((
e
:
Error
)
=>
reject
(
e
))
if
(
!
exists
)
{
this
.
emit
(
'fileAdded'
,
args
.
path
)
}
else
{
this
.
emit
(
'fileChanged'
,
args
.
path
)
}
}
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -129,6 +143,7 @@ export class RemixdClient extends PluginClient {
...
@@ -129,6 +143,7 @@ export class RemixdClient extends PluginClient {
console
.
log
(
error
)
console
.
log
(
error
)
reject
(
error
.
message
)
reject
(
error
.
message
)
}
}
this
.
emit
(
'fileRenamed'
,
args
.
oldPath
,
args
.
newPath
)
resolve
(
true
)
resolve
(
true
)
})
})
})
})
...
@@ -150,6 +165,7 @@ export class RemixdClient extends PluginClient {
...
@@ -150,6 +165,7 @@ export class RemixdClient extends PluginClient {
console
.
log
(
error
)
console
.
log
(
error
)
reject
(
'Failed to remove file/directory: '
+
error
)
reject
(
'Failed to remove file/directory: '
+
error
)
}
}
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