Start HistoryManager with config path argument

HistoryManager was not finding the Logs.db when Gajim was
used with the -c config path argument
This commit is contained in:
Philipp Hörist 2017-04-21 18:44:27 +02:00
parent 8e3e9b4d9d
commit 0b0812bb75
2 changed files with 11 additions and 12 deletions

View File

@ -60,16 +60,15 @@ class AppActions():
gajim.interface.instances['accounts'] = config.AccountsWindow() gajim.interface.instances['accounts'] = config.AccountsWindow()
def on_history_manager(self, action, param): def on_history_manager(self, action, param):
if os.name == 'nt': config_path = '-c %s' % gajim.gajimpaths.config_root
if os.path.exists('history_manager.exe'): posix = os.name != 'nt'
# user is running frozen application if os.path.exists('history_manager.exe'): # Windows
helpers.exec_command('history_manager.exe') helpers.exec_command('history_manager.exe %s' % config_path,
else: posix=posix)
# user is running from source else: # Linux or running from Git
helpers.exec_command('%s history_manager.py' % sys.executable) helpers.exec_command(
else: '%s history_manager.py %s' % (sys.executable, config_path),
# Unix user posix=posix)
helpers.exec_command('%s history_manager.py' % sys.executable)
def on_manage_bookmarks(self, action, param): def on_manage_bookmarks(self, action, param):
config.ManageBookmarksWindow() config.ManageBookmarksWindow()

View File

@ -408,7 +408,7 @@ def is_in_path(command, return_abs_path=False):
pass pass
return False 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 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 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: if use_shell:
subprocess.Popen('%s &' % command, shell=True).wait() subprocess.Popen('%s &' % command, shell=True).wait()
else: else:
args = shlex.split(command) args = shlex.split(command, posix=posix)
p = subprocess.Popen(args) p = subprocess.Popen(args)
gajim.thread_interface(p.wait) gajim.thread_interface(p.wait)