Created
May 11, 2022 14:09
-
-
Save lafftar/fba75ea40e6322588c5481af9513c40a to your computer and use it in GitHub Desktop.
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
import sys | |
from pathlib import Path | |
def get_project_root() -> str: | |
""" | |
This fx is super important! | |
Literally everything acts up if this isn't good. | |
""" | |
if getattr(sys, 'frozen', False): | |
compiled_path = Path(sys.executable).parent | |
return compiled_path | |
else: | |
path = str(Path(__file__).parent.parent) | |
path = path.replace("\\", '/') | |
return fr'{path}' | |
if __name__ == "__main__": | |
print(get_project_root()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment