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
36de70d3
Commit
36de70d3
authored
Mar 17, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure workspace provider is removing the uneeded part of the paths
parent
f93f459c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
fileProvider.js
apps/remix-ide/src/app/files/fileProvider.js
+12
-3
workspaceFileProvider.js
apps/remix-ide/src/app/files/workspaceFileProvider.js
+7
-0
No files found.
apps/remix-ide/src/app/files/fileProvider.js
View file @
36de70d3
...
@@ -196,11 +196,11 @@ class FileProvider {
...
@@ -196,11 +196,11 @@ class FileProvider {
}
}
/**
/**
* copy the folder recursively
* copy the folder recursively
(internal use)
* @param {string} path is the folder to be copied over
* @param {string} path is the folder to be copied over
* @param {string} destination is the destination folder
* @param {string} destination is the destination folder
*/
*/
copyFolderToJson
(
path
)
{
_copyFolderToJsonInternal
(
path
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
json
=
{}
const
json
=
{}
path
=
this
.
removePrefix
(
path
)
path
=
this
.
removePrefix
(
path
)
...
@@ -212,7 +212,7 @@ class FileProvider {
...
@@ -212,7 +212,7 @@ class FileProvider {
const
file
=
{}
const
file
=
{}
const
curPath
=
`
${
path
}${
path
.
endsWith
(
'/'
)
?
''
:
'/'
}${
item
}
`
const
curPath
=
`
${
path
}${
path
.
endsWith
(
'/'
)
?
''
:
'/'
}${
item
}
`
if
(
window
.
remixFileSystem
.
statSync
(
curPath
).
isDirectory
())
{
if
(
window
.
remixFileSystem
.
statSync
(
curPath
).
isDirectory
())
{
file
.
children
=
await
this
.
copyFolderToJson
(
curPath
)
file
.
children
=
await
this
.
_copyFolderToJsonInternal
(
curPath
)
}
else
{
}
else
{
file
.
content
=
window
.
remixFileSystem
.
readFileSync
(
curPath
,
'utf8'
)
file
.
content
=
window
.
remixFileSystem
.
readFileSync
(
curPath
,
'utf8'
)
}
}
...
@@ -228,6 +228,15 @@ class FileProvider {
...
@@ -228,6 +228,15 @@ class FileProvider {
})
})
}
}
/**
* copy the folder recursively
* @param {string} path is the folder to be copied over
* @param {string} destination is the destination folder
*/
copyFolderToJson
(
path
)
{
return
this
.
_copyFolderToJsonInternal
(
path
)
}
removeFile
(
path
)
{
removeFile
(
path
)
{
path
=
this
.
removePrefix
(
path
)
path
=
this
.
removePrefix
(
path
)
if
(
window
.
remixFileSystem
.
existsSync
(
path
)
&&
!
window
.
remixFileSystem
.
statSync
(
path
).
isDirectory
())
{
if
(
window
.
remixFileSystem
.
existsSync
(
path
)
&&
!
window
.
remixFileSystem
.
statSync
(
path
).
isDirectory
())
{
...
...
apps/remix-ide/src/app/files/workspaceFileProvider.js
View file @
36de70d3
...
@@ -48,6 +48,13 @@ class WorkspaceFileProvider extends FileProvider {
...
@@ -48,6 +48,13 @@ class WorkspaceFileProvider extends FileProvider {
})
})
}
}
async
copyFolderToJson
(
directory
)
{
let
json
=
await
super
.
_copyFolderToJsonInternal
(
directory
)
const
regex
=
new
RegExp
(
`.workspaces/
${
this
.
workspace
}
/`
,
'g'
);
json
=
JSON
.
stringify
(
json
).
replace
(
regex
,
''
)
return
JSON
.
parse
(
json
)
}
_normalizePath
(
path
)
{
_normalizePath
(
path
)
{
if
(
!
this
.
workspace
)
throw
new
Error
(
'No workspace has been opened.'
)
if
(
!
this
.
workspace
)
throw
new
Error
(
'No workspace has been opened.'
)
return
path
.
replace
(
this
.
workspacesPath
+
'/'
+
this
.
workspace
+
'/'
,
''
)
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