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... // collect the found indexes...
.on('match', function(path){ .on('match', function(path){
loaders.push(loadIndex(path, logger) loaders.push(loadIndex(path, index_dir, logger)
.then(function(obj){ .then(function(obj){
// NOTE: considering that all the paths within // NOTE: considering that all the paths within
// the index are relative to the preview // 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... // NOTE: this will prepare for version 2.0 file structure...
// //
// XXX write tags, marks and bookmarks only if changed... // XXX write tags, marks and bookmarks only if changed...
// XXX this is not yet correct...
var prepareIndex = var prepareIndex =
module.prepareIndex = module.prepareIndex =
function(json, changes){ function(json, changes){
@ -571,7 +572,13 @@ function(json, changes){
// NOTE: we write the whole set ONLY if an item is true or undefined // NOTE: we write the whole set ONLY if an item is true or undefined
// i.e. not false... // i.e. not false...
if(changes.bookmarked !== 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){ if(changes.selected !== false){

View File

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