tonistiigi/audiosprite

*.mp3 pattern for files doesn't work

Closed this issue · 2 comments

Log is attached below:
image

I suppose it wasn't implemented, but I can't say I understand all the code. I added this bit after line 38 in audiosprite.js and it seems to work.

//expand filelist for each wildcard
var newfiles = [];
var _i;
var _filename;
var _ext;
var _dir = process.cwd();
//opts.logger.info ( "current dir", { dir: _dir } );
var _dirfiles = fs.readdirSync ( _dir );
//opts.logger.info('Dirfiles', { length: _dirfiles.length });
for ( _i in files ) {
    _filename = files [ _i ];
    if ( _filename.indexOf ( "*." ) === 0 ) {
        _ext = _filename.slice ( 1 );
        opts.logger.debug('Wildcard found at', { file: _filename, extension: _ext });
        var _j;
        for ( _j in _dirfiles ) {
            if ( path.extname ( _dirfiles [ _j ] )  === _ext ) {
                newfiles.push ( _dirfiles [ _j ] );
                opts.logger.debug('file added to list', { file: _dirfiles [ _j ] } );
            }
        }
    }
    else {
        newfiles.push ( files [ _i ] );
    }       
}
files = newfiles;

Fixed in #41 (v.0.6.0 on npm)