Skip to content

Commit

Permalink
refactor: bedrock server installation path
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Mar 4, 2024
1 parent 79ab886 commit 3fe143b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
17 changes: 7 additions & 10 deletions python/src/endstone/_internal/bootstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def install_path(self) -> Path:
Returns:
Path: The path to the installation directory.
"""
return self._install_path
return self._install_path / self.target_system

@property
def server_path(self) -> Path:
Expand Down Expand Up @@ -128,15 +128,12 @@ def validate(self) -> None:
NotImplementedError: If the current platform system is not supported by this bootstrap.
FileNotFoundError: If either the executable_path or _endstone_runtime_path do not exist.
"""
assert platform.system() == self.target_system, NotImplementedError(
f"{platform.system()} is not supported by this bootstrap."
)
assert self.executable_path.exists(), FileNotFoundError(
errno.ENOENT, os.strerror(errno.ENOENT), str(self.executable_path)
)
assert self._endstone_runtime_path.exists(), FileNotFoundError(
errno.ENOENT, os.strerror(errno.ENOENT), str(self._endstone_runtime_path)
)
if platform.system().lower() != self.target_system:
raise NotImplementedError(f"{platform.system()} is not supported by this bootstrap.")
if not self.executable_path.exists():
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(self.executable_path))
if not self._endstone_runtime_path.exists():
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(self._endstone_runtime_path))

def _download(self, dst: Union[str, os.PathLike], url: str, sha256: str) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion python/src/endstone/_internal/bootstrap/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def name(self) -> str:

@property
def target_system(self) -> str:
return "Linux"
return "linux"

@property
def executable_filename(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion python/src/endstone/_internal/bootstrap/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def name(self) -> str:

@property
def target_system(self) -> str:
return "Windows"
return "windows"

@property
def executable_filename(self) -> str:
Expand Down

0 comments on commit 3fe143b

Please sign in to comment.