first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Paths: ~/.gpu-rent, app tree, SSH key."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def home_dir() -> Path:
|
||||
return Path.home() / ".gpu-rent"
|
||||
|
||||
|
||||
def env_path() -> Path:
|
||||
return home_dir() / ".env"
|
||||
|
||||
|
||||
def state_path() -> Path:
|
||||
return home_dir() / "state.json"
|
||||
|
||||
|
||||
def lock_path() -> Path:
|
||||
return home_dir() / "gpu-rent.lock"
|
||||
|
||||
|
||||
def default_ssh_key_path() -> Path:
|
||||
return home_dir() / "id_ed25519"
|
||||
|
||||
|
||||
def detect_app_root() -> Path:
|
||||
cwd = Path.cwd().resolve()
|
||||
for candidate in (cwd, *cwd.parents):
|
||||
if (candidate / "Models").is_dir() and (candidate / "docs").is_dir():
|
||||
return candidate
|
||||
return cwd
|
||||
Reference in New Issue
Block a user