fixes: post content tab release issues (#5566)
* fix: migrate old cache entries for CachedFileUpdate * feat: toggle goofy fix + switch version reimpl in app and panel * fix: multimc detection * fix: add tie breaker for sorting * feat: toggle hover state * fix: lint
This commit is contained in:
@@ -171,7 +171,9 @@ pub fn get_default_launcher_path(
|
||||
r#type: ImportLauncherType,
|
||||
) -> Option<PathBuf> {
|
||||
let path = match r#type {
|
||||
ImportLauncherType::MultiMC => None, // multimc data is *in* app dir
|
||||
ImportLauncherType::MultiMC => {
|
||||
return find_multimc_path();
|
||||
}
|
||||
ImportLauncherType::PrismLauncher => {
|
||||
Some(dirs::data_dir()?.join("PrismLauncher"))
|
||||
}
|
||||
@@ -195,6 +197,54 @@ pub fn get_default_launcher_path(
|
||||
if path.exists() { Some(path) } else { None }
|
||||
}
|
||||
|
||||
/// Searches common locations for a MultiMC installation.
|
||||
/// MultiMC stores data in its own application directory (not a standard data dir)
|
||||
fn find_multimc_path() -> Option<PathBuf> {
|
||||
let mut candidates: Vec<PathBuf> = Vec::new();
|
||||
|
||||
// Linux/macOS: ~/.local/share/multimc is the typical location
|
||||
if let Some(data_dir) = dirs::data_dir() {
|
||||
candidates.push(data_dir.join("multimc"));
|
||||
candidates.push(data_dir.join("MultiMC"));
|
||||
}
|
||||
|
||||
// Windows: check common extraction locations
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
candidates.push(home.join("MultiMC"));
|
||||
candidates.push(home.join("Desktop").join("MultiMC"));
|
||||
candidates.push(home.join("Downloads").join("MultiMC"));
|
||||
}
|
||||
candidates.push(PathBuf::from("C:\\MultiMC"));
|
||||
if let Some(program_files) =
|
||||
std::env::var_os("ProgramFiles").map(PathBuf::from)
|
||||
{
|
||||
candidates.push(program_files.join("MultiMC"));
|
||||
}
|
||||
if let Some(program_files_x86) =
|
||||
std::env::var_os("ProgramFiles(x86)").map(PathBuf::from)
|
||||
{
|
||||
candidates.push(program_files_x86.join("MultiMC"));
|
||||
}
|
||||
}
|
||||
|
||||
// macOS: MultiMC is a .app bundle with data inside MultiMC.app/Data/
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
candidates.push(PathBuf::from("/Applications/MultiMC.app/Data"));
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
candidates.push(
|
||||
home.join("Applications").join("MultiMC.app").join("Data"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
candidates
|
||||
.into_iter()
|
||||
.find(|p| p.join("multimc.cfg").exists())
|
||||
}
|
||||
|
||||
/// Checks if this PathBuf is a valid instance for the given launcher type
|
||||
|
||||
#[tracing::instrument]
|
||||
|
||||
Reference in New Issue
Block a user