Adjust default paths when running in AppImage.

main
Ben Niemann 1 year ago
parent edf3864f60
commit 660d935bdc

@ -249,6 +249,15 @@ class MainApp(App):
return self.__exit_code
def __parse_args(self, argv: List[str]) -> None:
defaultDataDir = config.DATA_DIR
defaultLibDir = config.LIB_DIR
assert defaultLibDir.startswith('/')
if 'APPDIR' in os.environ:
assert defaultDataDir.startswith('/')
defaultDataDir = os.path.join(os.environ['APPDIR'], defaultDataDir[1:])
assert defaultLibDir.startswith('/')
defaultLibDir = os.path.join(os.environ['APPDIR'], defaultLibDir[1:])
parser = argparse.ArgumentParser(
prog=argv[0])
parser.add_argument(
@ -263,12 +272,12 @@ class MainApp(App):
parser.add_argument(
'--data-dir',
metavar='PATH',
default=config.DATA_DIR,
default=defaultDataDir,
help="Path to noisicaa's data files (default: {})".format(config.DATA_DIR))
parser.add_argument(
'--lib-dir',
metavar='PATH',
default=config.LIB_DIR,
default=defaultLibDir,
help="Path to noisicaa's libraries (default: {})".format(config.LIB_DIR))
parser.add_argument(
'path',

Loading…
Cancel
Save