Compare commits

..

No commits in common. "c2a75319dcd5497e097800bfb3e44116574f7f06" and "1b8dfbad0314a59dc695d8b97af7a5c80641841c" have entirely different histories.

3 changed files with 10 additions and 24 deletions

22
app.js
View File

@ -22,13 +22,6 @@ const run = () => {
mainWindow = createWindow(); mainWindow = createWindow();
mainWindow.on('show', async () => { mainWindow.on('show', async () => {
const osuPath = await config.get("osuPath", ""); const osuPath = await config.get("osuPath", "");
const isValid = await osuUtil.isValidOsuFolder(osuPath);
if (osuPath.trim == "" || !isValid) {
mainWindow.webContents.send('status_update', {
type: "missing-folder"
})
return;
}
if (fs.existsSync(osuPath)) { if (fs.existsSync(osuPath)) {
tempOsuPath = osuPath; tempOsuPath = osuPath;
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath); const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
@ -41,17 +34,14 @@ const run = () => {
const releaseFiles = await osuUtil.getUpdateFiles(releaseStream); const releaseFiles = await osuUtil.getUpdateFiles(releaseStream);
const filesToDownload = await osuUtil.filesThatNeedUpdate(tempOsuPath, releaseFiles); const filesToDownload = await osuUtil.filesThatNeedUpdate(tempOsuPath, releaseFiles);
// const downloadTask = await osuUtil.downloadUpdateFiles(osuPath, filesToDownload); /* const downloadTask = await osuUtil.downloadUpdateFiles(osuPath, filesToDownload);
// downloadTask.on('completed', () => { downloadTask.on('completed', () => {
// console.log("done!"); console.log("done!");
// }); }); */
mainWindow.webContents.send('status_update', { mainWindow.webContents.send('status_update', {
type: filesToDownload.length > 0 ? "update-available" : "up-to-date" type: filesToDownload.length > 0 ? "update-available" : "up-to-date"
}) })
} else }
mainWindow.webContents.send('status_update', {
type: "missing-folder"
})
}) })
app.on('activate', function () { app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow(); if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
@ -66,7 +56,7 @@ const run = () => {
if (yes.filePaths.length <= 0) if (yes.filePaths.length <= 0)
return undefined; return undefined;
const folderPath = yes.filePaths[0]; const folderPath = yes.filePaths[0];
const validOsuDir = await osuUtil.isValidOsuFolder(folderPath); const validOsuDir = osuUtil.isValidOsuFolder(folderPath);
if (validOsuDir) await config.set("osuPath", folderPath); if (validOsuDir) await config.set("osuPath", folderPath);

View File

@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="../assets/logo.png" /> <link rel="icon" type="image/png" href="../assets/logo.png" />
<link href="../assets/mdb.min.css" rel="stylesheet" /> <link href="../assets/mdb.min.css" rel="stylesheet" />
<link href="../assets/sweetalert2.dark.css" rel="stylesheet" />
<style> <style>
* { * {
user-select: none; user-select: none;

View File

@ -22,16 +22,16 @@ window.addEventListener('DOMContentLoaded', () => {
if (success) { if (success) {
Swal.fire({ Swal.fire({
title: 'Success!', title: 'Success!',
text: 'osu! folder set.', text: 'osu! folder set!',
icon: 'success', icon: 'success',
confirmButtonText: 'Cool' confirmButtonText: 'Cool'
}) })
} else { } else {
Swal.fire({ Swal.fire({
title: 'Uh oh!', title: 'Uh oh!',
text: 'The selected folder is not a osu! directory.', text: 'failed to set osu! folder.',
icon: 'error', icon: 'error',
confirmButtonText: 'Oops.. my bad!' confirmButtonText: 'Cool'
}) })
} }
}); });
@ -46,11 +46,6 @@ window.addEventListener('DOMContentLoaded', () => {
$("#launch-btn").attr('disabled', false); $("#launch-btn").attr('disabled', false);
$('#launch-btn').html('Update'); $('#launch-btn').html('Update');
break; break;
case "missing-folder":
$('#launch-btn').html('Please set your osu folder!');
} }
}) })
// workaround for the dark theme
$('head').append($('<link href="../assets/sweetalert2.dark.css" rel="stylesheet" />'));
}) })