fixed a glob default change causing searches to fail on not being able to stat some abstract file in the tree...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-05-22 23:28:38 +03:00
parent 07a6be21d5
commit 2e8150c5bb
3 changed files with 17 additions and 8 deletions

View File

@ -510,7 +510,10 @@ var FileSystemLoaderActions = actions.Actions({
// get the image list... // get the image list...
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
glob(path + '/'+ that.config['image-file-pattern'], {stat: !!read_stat}) glob(path + '/'+ that.config['image-file-pattern'], {
stat: !!read_stat,
strict: false,
})
.on('error', function(err){ .on('error', function(err){
console.error(err) console.error(err)
reject(err) reject(err)

View File

@ -103,7 +103,7 @@ module.gGlob = function(){
var listIndexes = var listIndexes =
module.listIndexes = module.listIndexes =
function(base, index_dir){ function(base, index_dir){
return gGlob(base +'/**/'+ (index_dir || INDEX_DIR)) return gGlob(base +'/**/'+ (index_dir || INDEX_DIR), {strict: false})
} }
@ -134,7 +134,7 @@ var listPreviews =
module.listPreviews = module.listPreviews =
function(base, img_pattern){ function(base, img_pattern){
//return gGlob(base +'/*px/*jpg') //return gGlob(base +'/*px/*jpg')
return gGlob(base +'/*px/'+(img_pattern || '*')+'.jpg') return gGlob(base +'/*px/'+(img_pattern || '*')+'.jpg', {strict: false})
} }
@ -144,7 +144,7 @@ module.listJSON =
function(path, pattern){ function(path, pattern){
pattern = pattern || '*' pattern = pattern || '*'
path = util.normalizePath(path) path = util.normalizePath(path)
return gGlob(path +'/'+ pattern +'.json') return gGlob(path +'/'+ pattern +'.json', {strict: false})
} }
// wrap a node style callback function into a Promise... // wrap a node style callback function into a Promise...

View File

@ -184,6 +184,10 @@ Items.ListTitle = function(){}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Event system...
//
// XXX might be a good idea to make this a generic module...
// Generate an event method... // Generate an event method...
// //
@ -289,19 +293,21 @@ var makeItemEventMethod = function(event, handler, options){
// distinguish one from the other... // distinguish one from the other...
{ noQueryCheck: true }, { noQueryCheck: true },
options || {}) options || {})
// base event method...
// NOTE: this is not returned directly as we need to query the items // NOTE: this is not returned directly as we need to query the items
// and pass those on to the handlers rather than the arguments // and pass those on to the handlers rather than the arguments
// as-is... // as-is...
var method = makeEventMethod(event, var base = makeEventMethod(event,
function(evt, item, ...args){ function(evt, item, ...args){
handler handler
&& handler.call(this, evt, item.slice(), ...args) && handler.call(this, evt, item.slice(), ...args)
item.forEach(function(item){ item.forEach(function(item){
callItemEventHandlers(item, event, evt, ...args) }) }) callItemEventHandlers(item, event, evt, ...args) }) })
return Object.assign( return Object.assign(
// the actual method we return...
function(item, ...args){ function(item, ...args){
var that = this var that = this
return method.call(this, return base.call(this,
// event handler... // event handler...
item instanceof Function ? item instanceof Function ?
item item
@ -317,8 +323,8 @@ var makeItemEventMethod = function(event, handler, options){
this.search(item, options) this.search(item, options)
: [], : [],
...args) }, ...args) },
// get method attributes -- keep the event method format... // get base method attributes -- keep the event method format...
method) } base) }