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
24492e1f
Unverified
Commit
24492e1f
authored
Jan 04, 2021
by
yann300
Committed by
GitHub
Jan 04, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #689 from ethereum/fixFileManagerAPI
Fix removePrefix from fileProvider
parents
eafdbeec
6e3ce764
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
6 deletions
+24
-6
fileExplorer.test.ts
apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
+2
-1
fileManager_api.test.ts
apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
+17
-1
fileProvider.js
apps/remix-ide/src/app/files/fileProvider.js
+2
-1
remixDProvider.js
apps/remix-ide/src/app/files/remixDProvider.js
+1
-0
utils.ts
libs/remixd/src/utils.ts
+2
-3
No files found.
apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
View file @
24492e1f
...
@@ -105,7 +105,8 @@ module.exports = {
...
@@ -105,7 +105,8 @@ module.exports = {
.
waitForElementVisible
(
'*[key="browser/fileExplorer.test.js"]'
)
.
waitForElementVisible
(
'*[key="browser/fileExplorer.test.js"]'
)
.
waitForElementVisible
(
'*[key="browser/generalSettings.test.js"]'
)
.
waitForElementVisible
(
'*[key="browser/generalSettings.test.js"]'
)
.
end
()
.
end
()
},
},
tearDown
:
sauce
tearDown
:
sauce
}
}
apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
View file @
24492e1f
...
@@ -87,7 +87,15 @@ module.exports = {
...
@@ -87,7 +87,15 @@ module.exports = {
.
addFile
(
'removeFile.js'
,
{
content
:
executeRemove
})
.
addFile
(
'removeFile.js'
,
{
content
:
executeRemove
})
.
executeScript
(
`remix.exeCurrent()`
)
.
executeScript
(
`remix.exeCurrent()`
)
.
pause
(
2000
)
.
pause
(
2000
)
.
waitForElementNotPresent
(
'[data-id="treeViewLibrowser/old_contract.sol"]'
)
.
waitForElementNotPresent
(
'[data-id="treeViewLibrowser/old_contract.sol"]'
)
},
'Should execute `remove` api from file manager external api on a folder'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
addFile
(
'test_jsRemoveFolder.js'
,
{
content
:
executeRemoveOnFolder
})
.
executeScript
(
'remix.exeCurrent()'
)
.
pause
(
2000
)
.
waitForElementNotPresent
(
'*[key="browser/tests"]'
)
.
end
()
.
end
()
},
},
...
@@ -189,3 +197,11 @@ const executeRemove = `
...
@@ -189,3 +197,11 @@ const executeRemove = `
run()
run()
`
`
const
executeRemoveOnFolder
=
`(async () => {
try {
await remix.call('fileManager', 'remove', 'browser')
} catch (e) {
console.log(e.message)
}
})()`
apps/remix-ide/src/app/files/fileProvider.js
View file @
24492e1f
...
@@ -170,7 +170,7 @@ class FileProvider {
...
@@ -170,7 +170,7 @@ class FileProvider {
const
items
=
window
.
remixFileSystem
.
readdirSync
(
path
)
const
items
=
window
.
remixFileSystem
.
readdirSync
(
path
)
if
(
items
.
length
!==
0
)
{
if
(
items
.
length
!==
0
)
{
items
.
forEach
((
item
,
index
)
=>
{
items
.
forEach
((
item
,
index
)
=>
{
const
curPath
=
`
${
path
}
/
${
item
}
`
const
curPath
=
`
${
path
}
${
path
.
endsWith
(
'/'
)
?
''
:
'/'
}
${
item
}
`
if
(
window
.
remixFileSystem
.
statSync
(
curPath
).
isDirectory
())
{
// delete folder
if
(
window
.
remixFileSystem
.
statSync
(
curPath
).
isDirectory
())
{
// delete folder
this
.
remove
(
curPath
)
this
.
remove
(
curPath
)
}
else
{
// delete file
}
else
{
// delete file
...
@@ -238,6 +238,7 @@ class FileProvider {
...
@@ -238,6 +238,7 @@ class FileProvider {
removePrefix
(
path
)
{
removePrefix
(
path
)
{
path
=
path
.
indexOf
(
this
.
type
)
===
0
?
path
.
replace
(
this
.
type
,
''
)
:
path
path
=
path
.
indexOf
(
this
.
type
)
===
0
?
path
.
replace
(
this
.
type
,
''
)
:
path
if
(
path
===
''
)
return
'/'
return
path
return
path
}
}
...
...
apps/remix-ide/src/app/files/remixDProvider.js
View file @
24492e1f
...
@@ -166,6 +166,7 @@ module.exports = class RemixDProvider {
...
@@ -166,6 +166,7 @@ module.exports = class RemixDProvider {
removePrefix
(
path
)
{
removePrefix
(
path
)
{
path
=
path
.
indexOf
(
this
.
type
)
===
0
?
path
.
replace
(
this
.
type
,
''
)
:
path
path
=
path
.
indexOf
(
this
.
type
)
===
0
?
path
.
replace
(
this
.
type
,
''
)
:
path
if
(
path
[
0
]
===
'/'
)
return
path
.
substring
(
1
)
if
(
path
[
0
]
===
'/'
)
return
path
.
substring
(
1
)
if
(
path
===
''
)
return
'/'
return
path
return
path
}
}
...
...
libs/remixd/src/utils.ts
View file @
24492e1f
...
@@ -11,9 +11,7 @@ import * as pathModule from 'path'
...
@@ -11,9 +11,7 @@ import * as pathModule from 'path'
*/
*/
function
absolutePath
(
path
:
string
,
sharedFolder
:
string
):
string
{
function
absolutePath
(
path
:
string
,
sharedFolder
:
string
):
string
{
path
=
normalizePath
(
path
)
path
=
normalizePath
(
path
)
if
(
path
.
indexOf
(
sharedFolder
)
!==
0
)
{
path
=
pathModule
.
resolve
(
sharedFolder
,
path
)
path
=
pathModule
.
resolve
(
sharedFolder
,
path
)
}
return
path
return
path
}
}
...
@@ -34,6 +32,7 @@ function normalizePath (path: string): string {
...
@@ -34,6 +32,7 @@ function normalizePath (path: string): string {
if
(
process
.
platform
===
'win32'
)
{
if
(
process
.
platform
===
'win32'
)
{
return
path
.
replace
(
/
\\
/g
,
'/'
)
return
path
.
replace
(
/
\\
/g
,
'/'
)
}
}
if
(
path
===
'/'
)
path
=
'./'
return
path
return
path
}
}
...
...
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