citra-emu
/
citra-web
Archived
1
0
Fork 0

Using path.extname instead of slice for detecting file extensions.

This commit is contained in:
chris062689 2017-06-04 17:19:50 -04:00
parent 5d2fc8cac5
commit 9563833fdf
1 changed files with 3 additions and 3 deletions

View File

@ -105,9 +105,9 @@ try {
// Copy all savefiles into the output folder and store their contents.
fs.readdirSync(inputDirectorySavefilesGame).forEach(file => {
if (file.slice(-5) == '.zip') {
if (path.extname(file) == '.zip') {
fsextra.copySync(`${inputDirectorySavefilesGame}/${file}`, `${outputDirectorySavefilesGame}/${file.replace('.zip', '.csav')}`);
} else if (file.slice(-4) == '.dat') {
} else if (path.extname(file) == '.dat') {
// Store the contents of the file in memory for adding it into the markdown later.
savefileMetadataContents.push({ filename: file.replace('.dat', '.csav'), contents: fs.readFileSync(`${inputDirectorySavefilesGame}/${file}`, 'utf8') });
}
@ -126,7 +126,7 @@ try {
// Copy all screenshots into the output folder.
fs.readdirSync(inputDirectoryScreenshotsGame).forEach(file => {
if (file.slice(-4) == '.png') {
if (path.extname(file) == '.png') {
fsextra.copySync(`${inputDirectoryScreenshotsGame}/${file}`, `${outputDirectoryScreenshotsGame}/${file}`);
}
});