-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd48c3d
commit 4365cfd
Showing
3 changed files
with
7 additions
and
6 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
from pkg_resources import resource_filename | ||
from ii_game.scripts.utils import fixPath | ||
import os | ||
|
||
DEV_RUN = os.path.abspath(".").endswith("interplanetary-invaders") | ||
|
||
def get_file(filename): | ||
if filename.startswith("data"): | ||
DIR = f"{os.environ['HOME']}/.ii_game-data/" | ||
if filename in ("data", "data/"): | ||
DIR = fixPath(f"{os.environ['HOME']}/.ii_game-data/") | ||
if filename in ("data", fixPath("data/")): | ||
filename = "" | ||
else: | ||
filename = filename.replace("data/", "") | ||
filename = filename.replace(fixPath("data/"), "") | ||
if not os.path.exists(DIR): | ||
print(f"Building personal data directory:\n{DIR}") | ||
os.mkdir(DIR) | ||
return DIR+filename | ||
else: | ||
if DEV_RUN: # Your running this as a devolper | ||
return "ii_game/" + filename # Find it in the current directory | ||
return fixPath("ii_game/") + filename # Find it in the current directory | ||
return resource_filename("ii_game", filename) # Find it in the installation |
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