Handle absolute and relative paths.

This commit is contained in:
Tomas Groth 2019-04-30 21:43:41 +02:00
parent e14dd69817
commit b3c1996e4f

View File

@ -30,6 +30,7 @@ import argparse
import logging import logging
import sys import sys
import time import time
import os
from datetime import datetime from datetime import datetime
from traceback import format_exception from traceback import format_exception
@ -359,7 +360,11 @@ def main(args=None):
Settings.setDefaultFormat(Settings.IniFormat) Settings.setDefaultFormat(Settings.IniFormat)
# Get location OpenLPPortable.ini # Get location OpenLPPortable.ini
if args.portablepath: 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: else:
portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' / '..').resolve() portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' / '..').resolve()
data_path = portable_path / 'Data' data_path = portable_path / 'Data'