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
4fa4d424
Commit
4fa4d424
authored
May 25, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented old api redirection to new api
parent
129bf2e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
fileManager.js
src/app/files/fileManager.js
+12
-7
No files found.
src/app/files/fileManager.js
View file @
4fa4d424
...
@@ -23,7 +23,7 @@ const profile = {
...
@@ -23,7 +23,7 @@ const profile = {
icon
:
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4='
,
icon
:
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4='
,
permission
:
true
,
permission
:
true
,
version
:
packageJson
.
version
,
version
:
packageJson
.
version
,
methods
:
[
'file'
,
'exists'
,
'open'
,
'writeFile'
,
'readFile'
,
'copyFile'
,
'rename'
,
'readdir'
,
'remove'
],
methods
:
[
'file'
,
'exists'
,
'open'
,
'writeFile'
,
'readFile'
,
'copyFile'
,
'rename'
,
'readdir'
,
'remove'
,
'getCurrentFile'
,
'getFile'
,
'getFolder'
,
'setFile'
,
'switchFile'
],
kind
:
'file-system'
kind
:
'file-system'
}
}
const
errorMsg
=
{
const
errorMsg
=
{
...
@@ -155,9 +155,9 @@ class FileManager extends Plugin {
...
@@ -155,9 +155,9 @@ class FileManager extends Plugin {
async
writeFile
(
path
,
data
)
{
async
writeFile
(
path
,
data
)
{
if
(
await
this
.
exists
(
path
))
{
if
(
await
this
.
exists
(
path
))
{
await
this
.
_handleIsFile
(
path
,
`Cannot write file
${
path
}
`
)
await
this
.
_handleIsFile
(
path
,
`Cannot write file
${
path
}
`
)
return
await
this
.
setFile
(
path
,
data
)
return
await
this
.
setFile
Content
(
path
,
data
)
}
else
{
}
else
{
return
await
this
.
setFile
(
path
,
data
)
return
await
this
.
setFile
Content
(
path
,
data
)
}
}
}
}
...
@@ -169,7 +169,7 @@ class FileManager extends Plugin {
...
@@ -169,7 +169,7 @@ class FileManager extends Plugin {
async
readFile
(
path
)
{
async
readFile
(
path
)
{
await
this
.
_handleExists
(
path
,
`Cannot read file
${
path
}
`
)
await
this
.
_handleExists
(
path
,
`Cannot read file
${
path
}
`
)
await
this
.
_handleIsFile
(
path
,
`Cannot read file
${
path
}
`
)
await
this
.
_handleIsFile
(
path
,
`Cannot read file
${
path
}
`
)
return
this
.
getFile
(
path
)
return
this
.
getFile
Content
(
path
)
}
}
/**
/**
...
@@ -259,6 +259,11 @@ class FileManager extends Plugin {
...
@@ -259,6 +259,11 @@ class FileManager extends Plugin {
this
.
_deps
.
localhostExplorer
.
event
.
register
(
'fileRemoved'
,
(
path
)
=>
{
this
.
fileRemovedEvent
(
path
)
})
this
.
_deps
.
localhostExplorer
.
event
.
register
(
'fileRemoved'
,
(
path
)
=>
{
this
.
fileRemovedEvent
(
path
)
})
this
.
_deps
.
localhostExplorer
.
event
.
register
(
'errored'
,
(
event
)
=>
{
this
.
removeTabsOf
(
this
.
_deps
.
localhostExplorer
)
})
this
.
_deps
.
localhostExplorer
.
event
.
register
(
'errored'
,
(
event
)
=>
{
this
.
removeTabsOf
(
this
.
_deps
.
localhostExplorer
)
})
this
.
_deps
.
localhostExplorer
.
event
.
register
(
'closed'
,
(
event
)
=>
{
this
.
removeTabsOf
(
this
.
_deps
.
localhostExplorer
)
})
this
.
_deps
.
localhostExplorer
.
event
.
register
(
'closed'
,
(
event
)
=>
{
this
.
removeTabsOf
(
this
.
_deps
.
localhostExplorer
)
})
this
.
getCurrentFile
=
this
.
file
this
.
getFile
=
this
.
readFile
this
.
getFolder
=
this
.
readdir
this
.
setFile
=
this
.
writeFile
this
.
switchFile
=
this
.
open
}
}
fileChangedEvent
(
path
)
{
fileChangedEvent
(
path
)
{
...
@@ -332,7 +337,7 @@ class FileManager extends Plugin {
...
@@ -332,7 +337,7 @@ class FileManager extends Plugin {
return
path
?
path
[
1
]
:
null
return
path
?
path
[
1
]
:
null
}
}
getFile
(
path
)
{
getFile
Content
(
path
)
{
const
provider
=
this
.
fileProviderOf
(
path
)
const
provider
=
this
.
fileProviderOf
(
path
)
if
(
!
provider
)
throw
createError
({
code
:
'ENOENT'
,
message
:
`
${
path
}
not available`
})
if
(
!
provider
)
throw
createError
({
code
:
'ENOENT'
,
message
:
`
${
path
}
not available`
})
...
@@ -346,9 +351,9 @@ class FileManager extends Plugin {
...
@@ -346,9 +351,9 @@ class FileManager extends Plugin {
})
})
}
}
async
setFile
(
path
,
content
)
{
async
setFile
Content
(
path
,
content
)
{
if
(
this
.
currentRequest
)
{
if
(
this
.
currentRequest
)
{
const
canCall
=
await
this
.
askUserPermission
(
'
set
File'
,
''
)
const
canCall
=
await
this
.
askUserPermission
(
'
write
File'
,
''
)
if
(
canCall
)
{
if
(
canCall
)
{
this
.
_setFileInternal
(
path
,
content
)
this
.
_setFileInternal
(
path
,
content
)
// inform the user about modification after permission is granted and even if permission was saved before
// inform the user about modification after permission is granted and even if permission was saved before
...
...
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