lib/main.js
function wildcards(f, cb, ctxt) {
    var starmatch = f.match(/([^*]*)\*.*/);
    if (!starmatch) { //keep async
        process.nextTick(function () {
            cb.apply(ctxt, [f]);
        });
        return;
    }

    var basedirPath = starmatch[1].split(/\//);
    basedirPath.pop();
    var wkdir = basedirPath.join('/');
    //console.log('search base : %s', wkdir);
    var r = f.substring(wkdir.length + 1);
    //console.log('match pattern: %s', r);
    glob(r, {
        cwd: wkdir
    }, function (err, matches) {
        if (err) {
            ctxt.emit('error', err);
        } else {
            console.log(matches);
            matches.forEach(function (f) {
                cb.apply(ctxt, [path.join(wkdir, f)]);
            });
        }
    });
}
function wildcards(f, cb, ctxt) {
    var starmatch = f.match(/([^*]*)\*.*/);
    if (!starmatch) { //keep async
        process.nextTick(function () {
            cb.apply(ctxt, [f]);
        });
        return;
    }

    var basedirPath = starmatch[1].split(/\//);
    basedirPath.pop();
    var wkdir = basedirPath.join('/');
    //console.log('search base : %s', wkdir);
    var r = f.substring(wkdir.length + 1);
    //console.log('match pattern: %s', r);
    glob(r, {
        cwd: wkdir
    }, function (err, matches) {
        if (err) {
            ctxt.emit('error', err);
        } else {
            console.log(matches);
            matches.forEach(function (f) {
                cb.apply(ctxt, [path.join(wkdir, f)]);
            });
        }
    });
}
function wildcards ( f , cb , ctxt ) { var starmatch = f . match ( / ([^*]*)\*.* / ) ; if ( ! starmatch ) { //keep async process . nextTick ( function ( ) { cb . apply ( ctxt , [ f ] ) ; } ) ; return ; } var basedirPath = starmatch [ 1 ] . split ( / \/ / ) ; basedirPath . pop ( ) ; var wkdir = basedirPath . join ( '/' ) ; //console.log('search base : %s', wkdir); var r = f . substring ( wkdir . length + 1 ) ; //console.log('match pattern: %s', r); glob ( r , { cwd : wkdir } , function ( err , matches ) { if ( err ) { ctxt . emit ( 'error' , err ) ; } else { console . log ( matches ) ; matches . forEach ( function ( f ) { cb . apply ( ctxt , [ path . join ( wkdir , f ) ] ) ; } ) ; } } ) ; }
handle wildcards in filenames
@param f: filename.
@param cb : callback when a matching file is found.
@param ctxt : callback invocation context.
handle wildcards in filenames