Skip to content

Commit

Permalink
Fix bugs lol
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Jan 16, 2025
1 parent 07109ca commit 72b4d81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/libmoonlight/src/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function getInjector(override) {

// resolve default path
switch (os.platform()) {
case "windows":
case "win32":
return path.join(process.env.APPDATA, "moonlight-mod", DOWNLOAD_DIR, "injector.js");
case "darwin":
return path.join(os.homedir(), "Library", "Application Support", "moonlight-mod", DOWNLOAD_DIR, "injector.js");
Expand Down
12 changes: 7 additions & 5 deletions crates/libmoonlight/src/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ impl Installer {
let appdata = std::env::var("LocalAppData").unwrap();
let dirs = [
("Discord", Branch::Stable),
("Discord PTB", Branch::PTB),
("Discord Canary", Branch::Canary),
("Discord Development", Branch::Development),
("DiscordPTB", Branch::PTB),
("DiscordCanary", Branch::Canary),
("DiscordDevelopment", Branch::Development),
];
let mut installs = vec![];

Expand Down Expand Up @@ -308,8 +308,10 @@ impl Installer {
pub fn patch_install(
&self,
install: &DetectedInstall,
moonlight_dir: Option<PathBuf>,
override_download_dir: Option<PathBuf>,
) -> crate::Result<()> {
let download_dir = override_download_dir.unwrap_or_else(get_download_dir);

// TODO: flatpak and stuff
let app_dir = get_app_dir(&install.path)?;
let asar = app_dir.join("app.asar");
Expand All @@ -323,7 +325,7 @@ impl Installer {
});
std::fs::write(app_dir.join("app/package.json"), json.to_string())?;

let moonlight_injector = moonlight_dir.map(|m| m.join("injector.js"));
let moonlight_injector = download_dir.join("injector.js");
let injector = format!(
r#"const MOONLIGHT_INJECTOR = {};
const PATCHED_ASAR = {};
Expand Down

0 comments on commit 72b4d81

Please sign in to comment.