mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
working on file store cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3a8763c817
commit
db57070cfb
23
pwiki2.js
23
pwiki2.js
@ -925,11 +925,18 @@ async function(base, sub, options={index: '.index'}){
|
|||||||
levels.pop() }
|
levels.pop() }
|
||||||
return target }
|
return target }
|
||||||
// XXX cleanup all sub-paths...
|
// XXX cleanup all sub-paths...
|
||||||
|
// - remove empty leaf dirs
|
||||||
|
// - dir -> file ???
|
||||||
var cleanup =
|
var cleanup =
|
||||||
module.cleanup =
|
module.cleanup =
|
||||||
async function(base){
|
async function(base, options={index: '.index'}){
|
||||||
// XXX
|
glob(module.path.join(base, '**/*'))
|
||||||
}
|
.on('end', function(paths){
|
||||||
|
paths
|
||||||
|
.sort(function(a, b){
|
||||||
|
return b.length - a.length })
|
||||||
|
// XXX
|
||||||
|
}) }
|
||||||
|
|
||||||
|
|
||||||
// XXX add a lock file and prevent multiple adapters from controlling
|
// XXX add a lock file and prevent multiple adapters from controlling
|
||||||
@ -956,11 +963,11 @@ module.FileStore = {
|
|||||||
glob(module.path.join(that.__path__, '**/*'))
|
glob(module.path.join(that.__path__, '**/*'))
|
||||||
.on('end', function(paths){
|
.on('end', function(paths){
|
||||||
Promise.all(paths
|
Promise.all(paths
|
||||||
.map(async function(path){
|
.map(async function(path){
|
||||||
return await module.exists(path) ?
|
return await module.exists(path) ?
|
||||||
path
|
path
|
||||||
.slice(that.__path__.length)
|
.slice(that.__path__.length)
|
||||||
: [] }))
|
: [] }))
|
||||||
.then(function(paths){
|
.then(function(paths){
|
||||||
resolve(paths.flat()) }) }) }) },
|
resolve(paths.flat()) }) }) }) },
|
||||||
__exists__: async function(path){
|
__exists__: async function(path){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user