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
4cb52639
Commit
4cb52639
authored
Mar 02, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
throw if no workspace
parent
ea0be92c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
fileManager.js
apps/remix-ide/src/app/files/fileManager.js
+12
-2
workspaceFileProvider.js
apps/remix-ide/src/app/files/workspaceFileProvider.js
+12
-0
No files found.
apps/remix-ide/src/app/files/fileManager.js
View file @
4cb52639
...
...
@@ -514,6 +514,8 @@ class FileManager extends Plugin {
if
(
file
.
startsWith
(
'browser'
))
{
return
this
.
_deps
.
filesProviders
.
browser
}
const
provider
=
this
.
_deps
.
filesProviders
.
workspace
if
(
!
provider
.
isReady
())
throw
createError
({
code
:
'ECONNRESET'
,
message
:
'No workspace has been opened.'
})
return
this
.
_deps
.
filesProviders
.
workspace
}
...
...
@@ -579,7 +581,11 @@ class FileManager extends Plugin {
async
.
each
(
Object
.
keys
(
filesSet
),
(
file
,
callback
)
=>
{
if
(
override
)
{
self
.
_deps
.
filesProviders
[
fileProvider
].
set
(
file
,
filesSet
[
file
].
content
)
try
{
self
.
_deps
.
filesProviders
[
fileProvider
].
set
(
file
,
filesSet
[
file
].
content
)
}
catch
(
e
)
{
return
callback
(
e
.
message
||
e
)
}
self
.
syncEditor
(
fileProvider
+
file
)
return
callback
()
}
...
...
@@ -591,7 +597,11 @@ class FileManager extends Plugin {
}
else
if
(
helper
.
checkSpecialChars
(
name
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
}
else
{
self
.
_deps
.
filesProviders
[
fileProvider
].
set
(
name
,
filesSet
[
file
].
content
)
try
{
self
.
_deps
.
filesProviders
[
fileProvider
].
set
(
name
,
filesSet
[
file
].
content
)
}
catch
(
e
)
{
return
callback
(
e
.
message
||
e
)
}
self
.
syncEditor
(
fileProvider
+
name
)
}
callback
()
...
...
apps/remix-ide/src/app/files/workspaceFileProvider.js
View file @
4cb52639
...
...
@@ -6,6 +6,7 @@ class WorkspaceFileProvider extends FileProvider {
constructor
()
{
super
(
''
)
this
.
workspacesPath
=
'.workspaces'
this
.
workspace
=
null
}
setWorkspace
(
workspace
)
{
...
...
@@ -13,11 +14,20 @@ class WorkspaceFileProvider extends FileProvider {
this
.
workspace
=
workspace
}
getWorkspace
()
{
return
this
.
workspace
}
isReady
()
{
return
this
.
workspace
!==
null
}
clearWorkspace
()
{
this
.
workspace
=
null
}
removePrefix
(
path
)
{
if
(
!
this
.
workspace
)
throw
new
Error
(
'No workspace has been opened.'
)
path
=
path
.
replace
(
/^
\/
|
\/
$/g
,
''
)
// remove first and last slash
if
(
path
.
startsWith
(
this
.
workspacesPath
+
'/'
+
this
.
workspace
))
return
path
if
(
path
.
startsWith
(
this
.
workspace
))
return
this
.
workspacesPath
+
'/'
+
this
.
workspace
...
...
@@ -27,6 +37,7 @@ class WorkspaceFileProvider extends FileProvider {
}
resolveDirectory
(
path
,
callback
)
{
if
(
!
this
.
workspace
)
throw
new
Error
(
'No workspace has been opened.'
)
super
.
resolveDirectory
(
path
,
(
error
,
files
)
=>
{
if
(
error
)
return
callback
(
error
)
const
unscoped
=
{}
...
...
@@ -38,6 +49,7 @@ class WorkspaceFileProvider extends FileProvider {
}
_normalizePath
(
path
)
{
if
(
!
this
.
workspace
)
throw
new
Error
(
'No workspace has been opened.'
)
return
path
.
replace
(
this
.
workspacesPath
+
'/'
+
this
.
workspace
+
'/'
,
''
)
}
}
...
...
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