mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-19 17:23:57 +00:00
feat: disabling button when installing
This commit is contained in:
@@ -32,7 +32,8 @@ export class SevenZip {
|
||||
cwd?: string;
|
||||
passwords?: string[];
|
||||
},
|
||||
cb: (success: boolean) => void
|
||||
successCb: () => void,
|
||||
errorCb: () => void
|
||||
) {
|
||||
const tryPassword = (index = -1) => {
|
||||
const password = passwords[index] ?? "";
|
||||
@@ -52,7 +53,7 @@ export class SevenZip {
|
||||
console.log("EXIT CALLED", code, filePath);
|
||||
|
||||
if (code === 0) {
|
||||
cb(true);
|
||||
successCb();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ export class SevenZip {
|
||||
} else {
|
||||
logger.info(`Failed to extract file: ${filePath}`);
|
||||
|
||||
cb(false);
|
||||
errorCb();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -51,13 +51,12 @@ export class GameFilesManager {
|
||||
cwd: directoryPath,
|
||||
passwords: ["online-fix.me", "steamrip.com"],
|
||||
},
|
||||
async (success) => {
|
||||
if (success) {
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error(`Failed to extract file: ${file}`));
|
||||
this.clearExtractionState();
|
||||
}
|
||||
() => {
|
||||
resolve(true);
|
||||
},
|
||||
() => {
|
||||
reject(new Error(`Failed to extract file: ${file}`));
|
||||
this.clearExtractionState();
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -126,32 +125,31 @@ export class GameFilesManager {
|
||||
outputPath: extractionPath,
|
||||
passwords: ["online-fix.me", "steamrip.com"],
|
||||
},
|
||||
async (success) => {
|
||||
if (success) {
|
||||
await this.extractFilesInDirectory(extractionPath);
|
||||
async () => {
|
||||
await this.extractFilesInDirectory(extractionPath);
|
||||
|
||||
if (fs.existsSync(extractionPath) && fs.existsSync(filePath)) {
|
||||
fs.unlink(filePath, (err) => {
|
||||
if (err) {
|
||||
logger.error(
|
||||
`Failed to delete file: ${download.folderName}`,
|
||||
err
|
||||
);
|
||||
if (fs.existsSync(extractionPath) && fs.existsSync(filePath)) {
|
||||
fs.unlink(filePath, (err) => {
|
||||
if (err) {
|
||||
logger.error(
|
||||
`Failed to delete file: ${download.folderName}`,
|
||||
err
|
||||
);
|
||||
|
||||
this.clearExtractionState();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await downloadsSublevel.put(gameKey, {
|
||||
...download!,
|
||||
folderName: path.parse(download.folderName!).name,
|
||||
this.clearExtractionState();
|
||||
}
|
||||
});
|
||||
|
||||
this.setExtractionComplete();
|
||||
} else {
|
||||
this.clearExtractionState();
|
||||
}
|
||||
|
||||
await downloadsSublevel.put(gameKey, {
|
||||
...download!,
|
||||
folderName: path.parse(download.folderName!).name,
|
||||
});
|
||||
|
||||
this.setExtractionComplete();
|
||||
},
|
||||
() => {
|
||||
this.clearExtractionState();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user