From 0b0812bb757b37eb3f5a10c70185602b19564090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Fri, 21 Apr 2017 18:44:27 +0200 Subject: [PATCH] Start HistoryManager with config path argument HistoryManager was not finding the Logs.db when Gajim was used with the -c config path argument --- src/app_actions.py | 19 +++++++++---------- src/common/helpers.py | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/app_actions.py b/src/app_actions.py index 644b40294..8faf802c5 100644 --- a/src/app_actions.py +++ b/src/app_actions.py @@ -60,16 +60,15 @@ class AppActions(): gajim.interface.instances['accounts'] = config.AccountsWindow() def on_history_manager(self, action, param): - if os.name == 'nt': - if os.path.exists('history_manager.exe'): - # user is running frozen application - helpers.exec_command('history_manager.exe') - else: - # user is running from source - helpers.exec_command('%s history_manager.py' % sys.executable) - else: - # Unix user - helpers.exec_command('%s history_manager.py' % sys.executable) + config_path = '-c %s' % gajim.gajimpaths.config_root + posix = os.name != 'nt' + if os.path.exists('history_manager.exe'): # Windows + helpers.exec_command('history_manager.exe %s' % config_path, + posix=posix) + else: # Linux or running from Git + helpers.exec_command( + '%s history_manager.py %s' % (sys.executable, config_path), + posix=posix) def on_manage_bookmarks(self, action, param): config.ManageBookmarksWindow() diff --git a/src/common/helpers.py b/src/common/helpers.py index 7236a01f0..4d3b5b431 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -408,7 +408,7 @@ def is_in_path(command, return_abs_path=False): pass return False -def exec_command(command, use_shell=False): +def exec_command(command, use_shell=False, posix=True): """ execute a command. if use_shell is True, we run the command as is it was typed in a console. So it may be dangerous if you are not sure about what @@ -417,7 +417,7 @@ def exec_command(command, use_shell=False): if use_shell: subprocess.Popen('%s &' % command, shell=True).wait() else: - args = shlex.split(command) + args = shlex.split(command, posix=posix) p = subprocess.Popen(args) gajim.thread_interface(p.wait)