add util method to detect osu folder, still needs to be tested on different systems.
This commit is contained in:
parent
84c13331d2
commit
337a8af68f
8
app.js
8
app.js
|
@ -147,6 +147,12 @@ const run = () => {
|
||||||
message: "Seems like you are missing the wmctrl package, please install it for the RPC to work!"
|
message: "Seems like you are missing the wmctrl package, please install it for the RPC to work!"
|
||||||
});
|
});
|
||||||
} else linuxWMCtrlFound = true;
|
} else linuxWMCtrlFound = true;
|
||||||
|
} else {
|
||||||
|
const osuFolder = await config.get("osuPath");
|
||||||
|
if (!osuFolder || osuFolder == "") {
|
||||||
|
const foundFolder = await osuUtil.findOsuInstallation();
|
||||||
|
console.log("osu! Installation located at: ",foundFolder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
app.on('activate', function () {
|
app.on('activate', function () {
|
||||||
|
@ -171,8 +177,10 @@ const run = () => {
|
||||||
}
|
}
|
||||||
rpc.updateState("Launching osu!...");
|
rpc.updateState("Launching osu!...");
|
||||||
isIngame = true;
|
isIngame = true;
|
||||||
|
mainWindow.hide();
|
||||||
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
||||||
isIngame = false;
|
isIngame = false;
|
||||||
|
mainWindow.show();
|
||||||
await doUpdateCheck(mainWindow);
|
await doUpdateCheck(mainWindow);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|
17
osuUtil.js
17
osuUtil.js
|
@ -171,8 +171,23 @@ async function setConfigValue(configPath, key, value) {
|
||||||
}
|
}
|
||||||
await fs.promises.writeFile(configPath, configLines.join("\n"), 'utf-8');
|
await fs.promises.writeFile(configPath, configLines.join("\n"), 'utf-8');
|
||||||
}
|
}
|
||||||
|
async function findOsuInstallation() {
|
||||||
|
const regedit = require('qiao-regedit');
|
||||||
|
|
||||||
|
const osuLocationFromDefaultIcon = "HKLM\\SOFTWARE\\Classes\\osu\\DefaultIcon";
|
||||||
|
const osuStruct = await regedit.listValuesSync(osuLocationFromDefaultIcon);
|
||||||
|
for (const line of osuStruct.split("\n")) {
|
||||||
|
if (line.includes("REG_SZ")) {
|
||||||
|
let value = (line.trim().split(" ")[2]);
|
||||||
|
value = value.substring(1, value.length - 3);
|
||||||
|
return value.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
||||||
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue
|
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue,
|
||||||
|
findOsuInstallation
|
||||||
}
|
}
|
|
@ -54,6 +54,7 @@
|
||||||
"get-window-by-name": "^2.0.0",
|
"get-window-by-name": "^2.0.0",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"node-downloader-helper": "^2.1.4",
|
"node-downloader-helper": "^2.1.4",
|
||||||
|
"qiao-regedit": "^0.1.5",
|
||||||
"sweetalert2": "^11.5.2"
|
"sweetalert2": "^11.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user