Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Fixed a bug with updates (closes #2) and one with downloads.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZudoB committed Jul 25, 2018
1 parent a381615 commit 1eba84a
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "Doki Doki Mod Manager!",
"description": "Mod Manager for Doki Doki Literature Club!",
"author": "Doki Doki Mod Manager! Development Team",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "https://doki.space",
"main": "src/common/main.js",
"scripts": {
Expand Down
13 changes: 6 additions & 7 deletions src/common/download/DownloadManager.js

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

2 changes: 1 addition & 1 deletion src/common/download/DownloadManager.js.map

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

14 changes: 6 additions & 8 deletions src/common/download/DownloadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class DownloadManager extends EventEmitter {
method: "GET",
url: firstItem.url,
}).on("response", (response) => {
firstItem.total_size = parseInt(response.headers["content-length"], 10);
firstItem.total_size = parseInt(response.headers["content-length"], 10) || 0;
}).on("data", (chunk) => {
firstItem.bytes_downloaded += chunk.length;

Expand All @@ -50,15 +50,13 @@ export class DownloadManager extends EventEmitter {
} else {
this.emit("progress", firstItem.bytes_downloaded / firstItem.total_size);
}
}).on("complete", () => {
firstItem.status = DownloadStatus.DONE;

if (firstItem.bytes_downloaded >= firstItem.total_size) {
firstItem.status = DownloadStatus.DONE;
this.emit("download finished");
this.emit("progress", 0); // no progress bar

this.emit("download finished");
this.emit("progress", 0); // no progress bar

this.bumpQueue();
}
this.bumpQueue();
}).pipe(createWriteStream(firstItem.saveTo));
}

Expand Down
8 changes: 7 additions & 1 deletion src/common/installs/InstallList.js

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

2 changes: 1 addition & 1 deletion src/common/installs/InstallList.js.map

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

8 changes: 7 additions & 1 deletion src/common/installs/InstallList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export default class InstallList {
return installs.map((install) => {
const path: string = joinPath(Config.readConfigValue("installFolder"), "installs", install);

const installData = JSON.parse(readFileSync(joinPath(path, "install.json")).toString("utf8"));
let installData = {"name": ""};

try {
installData = JSON.parse(readFileSync(joinPath(path, "install.json")).toString("utf8"));
} catch (e) {
installData = install;
}

return {
folderName: install,
Expand Down
13 changes: 8 additions & 5 deletions src/common/main.js

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

Loading

0 comments on commit 1eba84a

Please sign in to comment.