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
b4db7e19
Unverified
Commit
b4db7e19
authored
Oct 08, 2019
by
yann300
Committed by
GitHub
Oct 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typo: rename shareFolder => currentSharedFolder
parent
e6c71df1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
sharedFolder.js
src/services/sharedFolder.js
+16
-16
No files found.
src/services/sharedFolder.js
View file @
b4db7e19
...
@@ -12,15 +12,15 @@ module.exports = {
...
@@ -12,15 +12,15 @@ module.exports = {
this
.
websocket
=
websocket
this
.
websocket
=
websocket
},
},
sharedFolder
:
function
(
s
haredFolder
,
readOnly
)
{
sharedFolder
:
function
(
currentS
haredFolder
,
readOnly
)
{
this
.
sharedFolder
=
s
haredFolder
this
.
currentSharedFolder
=
currentS
haredFolder
this
.
readOnly
=
readOnly
this
.
readOnly
=
readOnly
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'rootFolderChanged'
,
{}))
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'rootFolderChanged'
,
{}))
},
},
list
:
function
(
args
,
cb
)
{
list
:
function
(
args
,
cb
)
{
try
{
try
{
cb
(
null
,
utils
.
walkSync
(
this
.
sharedFolder
,
{},
this
.
s
haredFolder
))
cb
(
null
,
utils
.
walkSync
(
this
.
currentSharedFolder
,
{},
this
.
currentS
haredFolder
))
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
e
.
message
)
cb
(
e
.
message
)
}
}
...
@@ -28,12 +28,12 @@ module.exports = {
...
@@ -28,12 +28,12 @@ module.exports = {
resolveDirectory
:
function
(
args
,
cb
)
{
resolveDirectory
:
function
(
args
,
cb
)
{
try
{
try
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
s
haredFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentS
haredFolder
)
if
(
this
.
websocket
&&
!
this
.
alreadyNotified
[
path
])
{
if
(
this
.
websocket
&&
!
this
.
alreadyNotified
[
path
])
{
this
.
alreadyNotified
[
path
]
=
1
this
.
alreadyNotified
[
path
]
=
1
this
.
setupNotifications
(
path
)
this
.
setupNotifications
(
path
)
}
}
cb
(
null
,
utils
.
resolveDirectory
(
path
,
this
.
s
haredFolder
))
cb
(
null
,
utils
.
resolveDirectory
(
path
,
this
.
currentS
haredFolder
))
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
e
.
message
)
cb
(
e
.
message
)
}
}
...
@@ -44,7 +44,7 @@ module.exports = {
...
@@ -44,7 +44,7 @@ module.exports = {
},
},
get
:
function
(
args
,
cb
)
{
get
:
function
(
args
,
cb
)
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
s
haredFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentS
haredFolder
)
if
(
!
fs
.
existsSync
(
path
))
{
if
(
!
fs
.
existsSync
(
path
))
{
return
cb
(
'File not found '
+
path
)
return
cb
(
'File not found '
+
path
)
}
}
...
@@ -63,14 +63,14 @@ module.exports = {
...
@@ -63,14 +63,14 @@ module.exports = {
},
},
exists
:
function
(
args
,
cb
)
{
exists
:
function
(
args
,
cb
)
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
s
haredFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentS
haredFolder
)
cb
(
null
,
fs
.
existsSync
(
path
))
cb
(
null
,
fs
.
existsSync
(
path
))
},
},
set
:
function
(
args
,
cb
)
{
set
:
function
(
args
,
cb
)
{
if
(
this
.
readOnly
)
return
cb
(
'Cannot write file: read-only mode selected'
)
if
(
this
.
readOnly
)
return
cb
(
'Cannot write file: read-only mode selected'
)
const
isFolder
=
args
.
path
.
endsWith
(
'/'
)
const
isFolder
=
args
.
path
.
endsWith
(
'/'
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
s
haredFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentS
haredFolder
)
if
(
fs
.
existsSync
(
path
)
&&
!
isRealPath
(
path
,
cb
))
return
if
(
fs
.
existsSync
(
path
)
&&
!
isRealPath
(
path
,
cb
))
return
if
(
args
.
content
===
'undefined'
)
{
// no !!!!!
if
(
args
.
content
===
'undefined'
)
{
// no !!!!!
console
.
log
(
'trying to write "undefined" ! stopping.'
)
console
.
log
(
'trying to write "undefined" ! stopping.'
)
...
@@ -91,11 +91,11 @@ module.exports = {
...
@@ -91,11 +91,11 @@ module.exports = {
rename
:
function
(
args
,
cb
)
{
rename
:
function
(
args
,
cb
)
{
if
(
this
.
readOnly
)
return
cb
(
'Cannot rename file: read-only mode selected'
)
if
(
this
.
readOnly
)
return
cb
(
'Cannot rename file: read-only mode selected'
)
var
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
s
haredFolder
)
var
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
currentS
haredFolder
)
if
(
!
fs
.
existsSync
(
oldpath
))
{
if
(
!
fs
.
existsSync
(
oldpath
))
{
return
cb
(
'File not found '
+
oldpath
)
return
cb
(
'File not found '
+
oldpath
)
}
}
var
newpath
=
utils
.
absolutePath
(
args
.
newPath
,
this
.
s
haredFolder
)
var
newpath
=
utils
.
absolutePath
(
args
.
newPath
,
this
.
currentS
haredFolder
)
if
(
!
isRealPath
(
oldpath
,
cb
))
return
if
(
!
isRealPath
(
oldpath
,
cb
))
return
fs
.
move
(
oldpath
,
newpath
,
(
error
,
data
)
=>
{
fs
.
move
(
oldpath
,
newpath
,
(
error
,
data
)
=>
{
if
(
error
)
console
.
log
(
error
)
if
(
error
)
console
.
log
(
error
)
...
@@ -105,7 +105,7 @@ module.exports = {
...
@@ -105,7 +105,7 @@ module.exports = {
remove
:
function
(
args
,
cb
)
{
remove
:
function
(
args
,
cb
)
{
if
(
this
.
readOnly
)
return
cb
(
'Cannot remove file: read-only mode selected'
)
if
(
this
.
readOnly
)
return
cb
(
'Cannot remove file: read-only mode selected'
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
s
haredFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
currentS
haredFolder
)
if
(
!
fs
.
existsSync
(
path
))
{
if
(
!
fs
.
existsSync
(
path
))
{
return
cb
(
'File not found '
+
path
)
return
cb
(
'File not found '
+
path
)
}
}
...
@@ -125,11 +125,11 @@ module.exports = {
...
@@ -125,11 +125,11 @@ module.exports = {
isbinaryfile(f, (error, isBinary) => {
isbinaryfile(f, (error, isBinary) => {
if (error) console.log(error)
if (error) console.log(error)
console.log('add', f)
console.log('add', f)
if (this.websocket.connection) this.websocket.send(message('created', { path: utils.relativePath(f, this.
s
haredFolder), isReadOnly: isBinary, isFolder: false }))
if (this.websocket.connection) this.websocket.send(message('created', { path: utils.relativePath(f, this.
currentS
haredFolder), isReadOnly: isBinary, isFolder: false }))
})
})
})
})
watcher.on('addDir', (f, stat) => {
watcher.on('addDir', (f, stat) => {
if (this.websocket.connection) this.websocket.send(message('created', { path: utils.relativePath(f, this.
s
haredFolder), isReadOnly: false, isFolder: true }))
if (this.websocket.connection) this.websocket.send(message('created', { path: utils.relativePath(f, this.
currentS
haredFolder), isReadOnly: false, isFolder: true }))
})
})
*/
*/
watcher
.
on
(
'change'
,
(
f
,
curr
,
prev
)
=>
{
watcher
.
on
(
'change'
,
(
f
,
curr
,
prev
)
=>
{
...
@@ -137,13 +137,13 @@ module.exports = {
...
@@ -137,13 +137,13 @@ module.exports = {
delete
this
.
trackDownStreamUpdate
[
f
]
delete
this
.
trackDownStreamUpdate
[
f
]
return
return
}
}
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'changed'
,
utils
.
relativePath
(
f
,
this
.
s
haredFolder
)))
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'changed'
,
utils
.
relativePath
(
f
,
this
.
currentS
haredFolder
)))
})
})
watcher
.
on
(
'unlink'
,
(
f
)
=>
{
watcher
.
on
(
'unlink'
,
(
f
)
=>
{
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'removed'
,
{
path
:
utils
.
relativePath
(
f
,
this
.
s
haredFolder
),
isFolder
:
false
}))
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'removed'
,
{
path
:
utils
.
relativePath
(
f
,
this
.
currentS
haredFolder
),
isFolder
:
false
}))
})
})
watcher
.
on
(
'unlinkDir'
,
(
f
)
=>
{
watcher
.
on
(
'unlinkDir'
,
(
f
)
=>
{
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'removed'
,
{
path
:
utils
.
relativePath
(
f
,
this
.
s
haredFolder
),
isFolder
:
true
}))
if
(
this
.
websocket
.
connection
)
this
.
websocket
.
send
(
message
(
'removed'
,
{
path
:
utils
.
relativePath
(
f
,
this
.
currentS
haredFolder
),
isFolder
:
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