couple of fixed + tweaking base path (still does not feel right)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-12-05 07:37:13 +03:00
parent fb09d05aa0
commit 4b632bc3bf
2 changed files with 22 additions and 6 deletions

View File

@ -370,7 +370,7 @@ function(path, index_dir, logger){
})
// collect the found indexes...
.on('match', function(path){
loaders.push(loadIndex(path, logger)
loaders.push(loadIndex(path, index_dir, logger)
.then(function(obj){
// NOTE: considering that all the paths within
// the index are relative to the preview
@ -558,6 +558,7 @@ module.buildIndex = function(index, base_path){
// NOTE: this will prepare for version 2.0 file structure...
//
// XXX write tags, marks and bookmarks only if changed...
// XXX this is not yet correct...
var prepareIndex =
module.prepareIndex =
function(json, changes){
@ -571,7 +572,13 @@ function(json, changes){
// NOTE: we write the whole set ONLY if an item is true or undefined
// i.e. not false...
if(changes.bookmarked !== false){
res.bookmarked = json.data.tags.bookmark
res.bookmarked = [
json.data.tags.bookmark,
// NOTE: this is for bookmark metadata line comments, text,
// tags, ... etc.
// XXX currently this is not used...
json.data.bookmark_data || {},
]
}
if(changes.selected !== false){

View File

@ -3337,6 +3337,7 @@ var FileSystemLoaderActions = actions.Actions({
},
// XXX need to revise these...
// XXX should there be a loaded path and a requested path???
base_path: null,
loaded_paths: null,
@ -3430,18 +3431,22 @@ var FileSystemLoaderActions = actions.Actions({
index.images.join(part.images)
}
loaded.push(k)
// XXX do a better merge and remove this...
// ...we either need to lazy-load clustered indexes
// or merge, in both cases base_path should reflet
// the fact that we have multiple indexes...
base_path = k
break
}
logger && logger.emit('load index', index)
that.loaded_paths = loaded
that.base_path = base_path
// XXX should we get the requested path or the base path currently loaded
//that.base_path = loaded.length == 1 ? loaded[0] : path
that.base_path = loaded.length == 1 ? loaded[0] : path
that.load(index)
})
}],
@ -3468,8 +3473,8 @@ var FileSystemLoaderActions = actions.Actions({
}],
clear: [function(){
this.base_path = null
this.loaded_paths = null
delete this.base_path
delete this.loaded_paths
}],
})
@ -3667,6 +3672,10 @@ var FileSystemWriterActions = actions.Actions({
if(path == null){
return
}
// XXX get a logger...
logger = logger || this.logger
// XXX get real base path...
path = path || this.base_path +'/'+ this.config['index-dir']