Commit 25d9feaf authored by Andreas Heimann's avatar Andreas Heimann Committed by GitHub

Merge pull request #19 from jy1263/glob

recreated getFileExtension function in srxd module using glob (now completely supports images and songs ending with parenthesis)
parents f465b3c2 994c0436
...@@ -107,10 +107,11 @@ class SRXD { ...@@ -107,10 +107,11 @@ class SRXD {
let dir = fs.readdirSync( path ); let dir = fs.readdirSync( path );
return dir.filter( elm => elm.match(new RegExp(`.*\.srtb$`, 'ig'))); return dir.filter( elm => elm.match(new RegExp(`.*\.srtb$`, 'ig')));
} }
getFileExtension(fileName, path) getFileExtension(fileName, filePath){
{ let filePathJoined = path.join(filePath, fileName);
let dir = fs.readdirSync( path ); let files = glob.sync(filePathJoined+".*");
return dir.filter( elm => elm.match(new RegExp(`(${fileName}).*\.$`, 'ig'))); if (files[0] != undefined){return [path.parse(files[0]).base];}
else {return [];}
} }
getSongCover(fileName) { getSongCover(fileName) {
let fileExtension = this.getFileExtension(fileName, path.join(userSettings.get('gameDirectory'), "AlbumArt") ); let fileExtension = this.getFileExtension(fileName, path.join(userSettings.get('gameDirectory'), "AlbumArt") );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment