file_path
This commit is contained in:
parent
1609b3da89
commit
8d948fd2ca
|
@ -7,8 +7,8 @@ import __main__
|
|||
|
||||
|
||||
def root_dir():
|
||||
if "FILE_NAME" in os.environ:
|
||||
return Path(os.environ["FILE_NAME"]).parent()
|
||||
if "FILE_PATH" in os.environ:
|
||||
return Path(os.environ["FILE_PATH"]).parent()
|
||||
|
||||
if __main__.__package__:
|
||||
return files(__main__.__package__)
|
||||
|
@ -30,8 +30,11 @@ def root_dir():
|
|||
|
||||
|
||||
def root_file():
|
||||
if "FILE_PATH" in os.environ:
|
||||
return Path(os.environ["FILE_PATH"])
|
||||
|
||||
if "FILE_NAME" in os.environ:
|
||||
return Path(os.environ["FILE_NAME"])
|
||||
return root_dir() / os.environ["FILE_NAME"]
|
||||
|
||||
if "__file__" in dir(__main__):
|
||||
return Path(__main__.__file__)
|
||||
|
|
Loading…
Reference in New Issue
Block a user