mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added '.' and '..' support to browse-walk...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5461a266ab
commit
fbddc9e2ad
@ -38,6 +38,7 @@ var browse = require('./browse')
|
|||||||
var listDirGlob =
|
var listDirGlob =
|
||||||
module.listDirGlob =
|
module.listDirGlob =
|
||||||
function(path, make){
|
function(path, make){
|
||||||
|
var that = this
|
||||||
path = path.constructor == Array ? path.join('/') : path
|
path = path.constructor == Array ? path.join('/') : path
|
||||||
path = /^[a-zA-Z]:/.test(path.trim()) ? path : '/'+path
|
path = /^[a-zA-Z]:/.test(path.trim()) ? path : '/'+path
|
||||||
|
|
||||||
@ -46,6 +47,13 @@ function(path, make){
|
|||||||
path = path.indexOf('*') < 0 ? path + '/*' : path
|
path = path.indexOf('*') < 0 ? path + '/*' : path
|
||||||
|
|
||||||
return new Promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
|
|
||||||
|
// XXX test...
|
||||||
|
if(that.options.dotDirs){
|
||||||
|
make(fullpath ? path + './' : './')
|
||||||
|
make(fullpath ? path + '../' : '../')
|
||||||
|
}
|
||||||
|
|
||||||
// XXX do we need this???
|
// XXX do we need this???
|
||||||
/*guaranteeEvents([
|
/*guaranteeEvents([
|
||||||
'match',
|
'match',
|
||||||
@ -125,6 +133,10 @@ function(path, make){
|
|||||||
}
|
}
|
||||||
var res = []
|
var res = []
|
||||||
|
|
||||||
|
if(that.options.dotDirs){
|
||||||
|
files.splice(0, 0, '.', '..')
|
||||||
|
}
|
||||||
|
|
||||||
files.map(function(file){
|
files.map(function(file){
|
||||||
return stat(path +'/'+ file)
|
return stat(path +'/'+ file)
|
||||||
.catch(function(err){
|
.catch(function(err){
|
||||||
@ -188,6 +200,7 @@ function(path, make){
|
|||||||
// NOTE: this should work from a chrome app and does not require anything
|
// NOTE: this should work from a chrome app and does not require anything
|
||||||
// but fs access...
|
// but fs access...
|
||||||
// XXX need a default for '/' on windows...
|
// XXX need a default for '/' on windows...
|
||||||
|
// XXX add '.' and '..' support...
|
||||||
var listDirBrowser =
|
var listDirBrowser =
|
||||||
module.listDirBrowser =
|
module.listDirBrowser =
|
||||||
function(path, make){
|
function(path, make){
|
||||||
@ -263,6 +276,9 @@ WalkPrototype.options = {
|
|||||||
fileCountPattern: '*',
|
fileCountPattern: '*',
|
||||||
|
|
||||||
disableFiles: false,
|
disableFiles: false,
|
||||||
|
|
||||||
|
// enable '.' and '..' dirs...
|
||||||
|
dotDirs: true,
|
||||||
}
|
}
|
||||||
WalkPrototype.options.__proto__ = browse.Browser.prototype.options
|
WalkPrototype.options.__proto__ = browse.Browser.prototype.options
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user