diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index 2ef5404a..6c5b18af 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -365,6 +365,7 @@ var FileSystemLoaderActions = actions.Actions({ loadIndex: ['- File/Load index', function(path, from_date, logger){ var that = this + var index_dir = util.normalizePath(this.config['index-dir']) // XXX get a logger... logger = logger || this.logger logger = logger && logger.push('Load') @@ -382,7 +383,7 @@ var FileSystemLoaderActions = actions.Actions({ // XXX make this load incrementally (i.e. and EventEmitter // a-la glob).... //file.loadIndex(path, this.config['index-dir'], logger) - return file.loadIndex(path, this.config['index-dir'], from_date, logger) + return file.loadIndex(path, index_dir, from_date, logger) .then(function(res){ // XXX if res is empty load raw... diff --git a/ui (gen4)/imagegrid/file.js b/ui (gen4)/imagegrid/file.js index 01eadd57..2f13a331 100755 --- a/ui (gen4)/imagegrid/file.js +++ b/ui (gen4)/imagegrid/file.js @@ -502,9 +502,11 @@ function(path, index_dir, from_date, logger){ var i = util.normalizePath(index_dir).split(/[\\\/]/g) var p = util.normalizePath(path).split(/[\\\/]/g).slice(-i.length) + var explicit_index_dir = (i.filter(function(e, j){ return e == p[j] }).length == i.length) + // we've got an index... // XXX do we need to check if if it's a dir??? - if(i.filter(function(e, j){ return e == p[j] }).length == i.length){ + if(explicit_index_dir){ logger && logger.emit('path', path) @@ -601,6 +603,23 @@ function(path, index_dir, from_date, logger){ } else { var res = {} + // special case: root index... + if(fse.existsSync(path +'/'+ index_dir)){ + var n = path +'/'+ index_dir + + return loadIndex(n, index_dir, from_date, logger) + .then(function(obj){ + // NOTE: considering that all the paths within + // the index are relative to the preview + // dir (the parent dir to the index root) + // we do not need to include the index + // itself in the base path... + res[path] = obj[n] + resolve(res) + }) + } + + // full search... getIndexes(path, index_dir, logger) .catch(function(err){ logger && logger.emit('error', err)