Created
April 29, 2024 00:18
-
-
Save lukacat10/80e30f8ca2a5595afcc6367651794721 to your computer and use it in GitHub Desktop.
Common program data saving directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import platform | |
PROGRAM_DIRECTORY_NAME = "AppName" | |
def get_program_data_path() -> Path: | |
path = None | |
if platform.system() == "Windows": | |
path = Path.home() / "AppData" / "Roaming" / PROGRAM_DIRECTORY_NAME | |
elif platform.system() == "Linux": | |
path = Path.home() / ".local" / "share" / PROGRAM_DIRECTORY_NAME | |
else: | |
raise RuntimeError("Platform not supported") | |
path.mkdir(parents=True, exist_ok=True) | |
return path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Public due to low attack surface