Skip to content

Commit

Permalink
Fix crash when app directory wasn't existing yet for new apps.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlkuesters committed Jun 5, 2022
1 parent 419574d commit 7d07aa2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "destrostudios",
"version": "1.3.0",
"version": "1.3.1",
"description": "destrostudios cross-game launcher, offering the possibility to login, download, update and start games.",
"author": "destrostudios",
"license": "MIT",
Expand Down
15 changes: 11 additions & 4 deletions src/main/local-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ function compareAppFiles(event, app, appFilesResponse, userDataPath) {
});
}

function getAllFilePaths(baseDirectory, directoryPath, dest = []) {
function getAllFilePaths(baseDirectory, directoryPath) {
const filePaths = [];
if (fs.existsSync(baseDirectory + directoryPath)) {
addAllFilePaths(baseDirectory, directoryPath, filePaths);
}
return filePaths;
}

function addAllFilePaths(baseDirectory, directoryPath, dest) {
const files = fs.readdirSync(baseDirectory + directoryPath)
files.forEach(file => {
const filePath = directoryPath + file;
if (fs.statSync(baseDirectory + filePath).isDirectory()) {
getAllFilePaths(baseDirectory, filePath + '/', dest);
addAllFilePaths(baseDirectory, filePath + '/', dest);
} else {
dest.push(filePath);
}
})
return dest;
});
}

function checkNextLocalFileForDeletion(localFilePaths, appFilesResponse, currentFileIndex, shouldBeDeletedCallback, finishedCallback) {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "destrostudios",
"version": "1.3.0",
"version": "1.3.1",
"description": "Destrostudios cross-game launcher, offering the possibility to login, download, update and start games.",
"author": "destrostudios",
"main": "electron-main.js",
Expand Down

0 comments on commit 7d07aa2

Please sign in to comment.