From b3c1996e4fa9541248b564ba4ae84dda5a11e0e0 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 30 Apr 2019 21:43:41 +0200 Subject: [PATCH] Handle absolute and relative paths. --- openlp/core/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/core/app.py b/openlp/core/app.py index 7317155cb..4a081c3ce 100644 --- a/openlp/core/app.py +++ b/openlp/core/app.py @@ -30,6 +30,7 @@ import argparse import logging import sys import time +import os from datetime import datetime from traceback import format_exception @@ -359,7 +360,11 @@ def main(args=None): Settings.setDefaultFormat(Settings.IniFormat) # Get location OpenLPPortable.ini if args.portablepath: - portable_path = str_to_path(args.portablepath) + if os.path.isabs(args.portablepath): + portable_path = str_to_path(args.portablepath).resolve() + else: + portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' / + str_to_path(args.portablepath)).resolve() else: portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' / '..').resolve() data_path = portable_path / 'Data'