mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
Add path parent option to module path and default to using local path
This commit is contained in:
parent
200a8d8827
commit
339d2878b4
2 changed files with 5 additions and 4 deletions
|
@ -23,7 +23,7 @@ except ImportError:
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
sys.ext('Please install pywin32')
|
sys.ext('Please install pywin32')
|
||||||
|
|
||||||
APP_ROOT = libs.util.module_path()
|
APP_ROOT = libs.util.module_path(parent=True)
|
||||||
|
|
||||||
# init preliminaries
|
# init preliminaries
|
||||||
SYS_ARGV = sys.argv[1:]
|
SYS_ARGV = sys.argv[1:]
|
||||||
|
|
|
@ -9,14 +9,15 @@ __all__ = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def module_path(module=__file__):
|
def module_path(module=__file__, parent=False):
|
||||||
try:
|
try:
|
||||||
path = module.__file__
|
path = module.__file__
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
path = module
|
path = module
|
||||||
directory = os.path.dirname(path)
|
directory = os.path.dirname(path)
|
||||||
parent = os.path.join(directory, os.pardir)
|
if parent:
|
||||||
absolute = os.path.abspath(parent)
|
directory = os.path.join(directory, os.pardir)
|
||||||
|
absolute = os.path.abspath(directory)
|
||||||
normalized = os.path.normpath(absolute)
|
normalized = os.path.normpath(absolute)
|
||||||
return normalized
|
return normalized
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue