Skip to content

Commit

Permalink
fix: also look for the .minecraft folder in the launcher files on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Jan 13, 2021
1 parent 55b8494 commit 5645789
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions beet/toolchain/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from importlib import import_module
from pathlib import Path
from traceback import format_exception
from typing import Any, Optional
from typing import Any, List, Optional


def format_exc(exc: BaseException) -> str:
Expand Down Expand Up @@ -42,14 +42,17 @@ def import_from_string(dotted_path: str, default_member: Optional[str] = None) -


def locate_minecraft() -> Optional[Path]:
path = None
locations: List[Path] = []
system = platform.system()

if system == "Linux":
path = Path("~/.minecraft").expanduser()
locations.append(Path("~/.minecraft").expanduser())
locations.append(
Path("~/.var/app/com.mojang.Minecraft/data/minecraft").expanduser()
)
elif system == "Darwin":
path = Path("~/Library/Application Support/minecraft").expanduser()
locations.append(Path("~/Library/Application Support/minecraft").expanduser())
elif system == "Windows":
path = Path(os.path.expandvars(r"%APPDATA%\.minecraft"))
locations.append(Path(os.path.expandvars(r"%APPDATA%\.minecraft")))

return path.resolve() if path and path.is_dir() else None
return next((path.resolve() for path in locations if path and path.is_dir()), None)

0 comments on commit 5645789

Please sign in to comment.