Commit 105427b8 authored by Philipp Hörist's avatar Philipp Hörist

Use consistent way to get paths

This lets us now import the app module without setting paths
parent 52cbae69
......@@ -31,7 +31,6 @@
import os
import sys
import logging
import locale
import uuid
from distutils.version import LooseVersion as V
from collections import namedtuple
......@@ -63,20 +62,6 @@ logger = None
# some plugins use that
gajimpaths = configpaths.gajimpaths
AVATAR_PATH = configpaths.get('AVATAR')
MY_EMOTS_PATH = configpaths.get('MY_EMOTS')
MY_ICONSETS_PATH = configpaths.get('MY_ICONSETS')
MY_MOOD_ICONSETS_PATH = configpaths.get('MY_MOOD_ICONSETS')
MY_ACTIVITY_ICONSETS_PATH = configpaths.get('MY_ACTIVITY_ICONSETS')
MY_CACERTS = configpaths.get('MY_CACERTS')
MY_PEER_CERTS_PATH = configpaths.get('MY_PEER_CERTS')
DATA_DIR = configpaths.get('DATA')
ICONS_DIR = configpaths.get('ICONS')
HOME_DIR = configpaths.get('HOME')
PLUGINS_DIRS = [configpaths.get('PLUGINS_BASE'),
configpaths.get('PLUGINS_USER')]
PLUGINS_CONFIG_DIR = configpaths.get('PLUGINS_CONFIG_DIR')
MY_CERT_DIR = configpaths.get('MY_CERT')
RecentGroupchat = namedtuple('RecentGroupchat', ['room', 'server', 'nickname'])
......
......@@ -32,6 +32,9 @@ from gajim.common.const import PathType, PathLocation
def get(key):
if key == 'PLUGINS_DIRS':
return [_paths['PLUGINS_BASE'],
_paths['PLUGINS_USER']]
return _paths[key]
......@@ -43,6 +46,10 @@ def get_paths(type_):
yield _paths[key]
def override_path(*args, **kwargs):
_paths._add(*args, **kwargs)
def set_separation(active: bool):
_paths.profile_separation = active
......
......@@ -1217,7 +1217,7 @@ class Connection(CommonConnection, ConnectionHandlers):
cacerts = ''
if os.name == 'nt':
cacerts = certifi.where()
mycerts = common.app.MY_CACERTS
mycerts = common.configpaths.get('MY_CACERTS')
tls_version = app.config.get_per('accounts', self.name, 'tls_version')
cipher_list = app.config.get_per('accounts', self.name, 'cipher_list')
......
......@@ -47,6 +47,7 @@ from gajim.common import helpers
from gajim.common import app
from gajim.common import dataforms
from gajim.common import jingle_xtls
from gajim.common import configpaths
from gajim.common.caps_cache import muc_caps_cache
from gajim.common.commands import ConnectionCommands
from gajim.common.pubsub import ConnectionPubSub
......@@ -391,7 +392,7 @@ class ConnectionVcard:
else:
app.log('avatar').info(
'Update (vCard): %s %s', obj.nick, obj.avatar_sha)
path = os.path.join(app.AVATAR_PATH, obj.avatar_sha)
path = os.path.join(configpaths.get('AVATAR'), obj.avatar_sha)
if not os.path.isfile(path):
app.log('avatar').info(
'Request (vCard): %s', obj.nick)
......@@ -572,7 +573,7 @@ class ConnectionVcard:
current_sha = app.config.get_per('accounts', self.name, 'avatar_sha')
if current_sha == avatar_sha:
path = os.path.join(app.AVATAR_PATH, current_sha)
path = os.path.join(configpaths.get('AVATAR'), current_sha)
if not os.path.isfile(path):
app.log('avatar').info(
'Caching (vCard): %s', current_sha)
......
......@@ -40,6 +40,7 @@ from gajim.common import helpers
from gajim.common import app
from gajim.common import i18n
from gajim.common import dataforms
from gajim.common import configpaths
from gajim.common.zeroconf.zeroconf import Constant
from gajim.common.const import KindConstant
from gajim.common.pep import SUPPORTED_PERSONAL_USER_EVENTS
......@@ -2738,7 +2739,8 @@ class NotificationEvent(nec.NetworkIncomingEvent):
if jid:
# we want an avatar
puny_jid = helpers.sanitize_filename(jid)
path_to_file = os.path.join(app.AVATAR_PATH, puny_jid) + suffix
path_to_file = os.path.join(
configpaths.get('AVATAR'), puny_jid) + suffix
path_to_local_file = path_to_file + '_local'
for extension in ('.png', '.jpeg'):
path_to_local_file_full = path_to_local_file + extension
......
......@@ -53,6 +53,7 @@ import nbxmpp
from gajim.common.i18n import Q_
from gajim.common.i18n import ngettext
from gajim.common import configpaths
try:
import precis_i18n.codec
......@@ -863,8 +864,8 @@ def check_soundfile_path(file_, dirs=None):
:return the path to file or None if it doesn't exists.
"""
if dirs is None:
dirs = [app.configpaths.get('MY_DATA'),
app.DATA_DIR]
dirs = [configpaths.get('MY_DATA'),
configpaths.get('DATA')]
if not file_:
return None
......@@ -891,8 +892,8 @@ def strip_soundfile_path(file_, dirs=None, abs=True):
return None
if dirs is None:
dirs = [app.configpaths.get('MY_DATA'),
app.DATA_DIR]
dirs = [configpaths.get('MY_DATA'),
configpaths.get('DATA')]
name = os.path.basename(file_)
for d in dirs:
......@@ -1257,31 +1258,32 @@ def get_current_show(account):
return app.SHOW_LIST[status]
def get_iconset_path(iconset):
if os.path.isdir(os.path.join(app.DATA_DIR, 'iconsets', iconset)):
return os.path.join(app.DATA_DIR, 'iconsets', iconset)
elif os.path.isdir(os.path.join(app.MY_ICONSETS_PATH, iconset)):
return os.path.join(app.MY_ICONSETS_PATH, iconset)
if os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', iconset)):
return os.path.join(configpaths.get('DATA'), 'iconsets', iconset)
elif os.path.isdir(os.path.join(configpaths.get('MY_ICONSETS'), iconset)):
return os.path.join(configpaths.get('MY_ICONSETS'), iconset)
def get_mood_iconset_path(iconset):
if os.path.isdir(os.path.join(app.DATA_DIR, 'moods', iconset)):
return os.path.join(app.DATA_DIR, 'moods', iconset)
elif os.path.isdir(os.path.join(app.MY_MOOD_ICONSETS_PATH, iconset)):
return os.path.join(app.MY_MOOD_ICONSETS_PATH, iconset)
if os.path.isdir(os.path.join(configpaths.get('DATA'), 'moods', iconset)):
return os.path.join(configpaths.get('DATA'), 'moods', iconset)
elif os.path.isdir(
os.path.join(configpaths.get('MY_MOOD_ICONSETS'), iconset)):
return os.path.join(configpaths.get('MY_MOOD_ICONSETS'), iconset)
def get_activity_iconset_path(iconset):
if os.path.isdir(os.path.join(app.DATA_DIR, 'activities', iconset)):
return os.path.join(app.DATA_DIR, 'activities', iconset)
elif os.path.isdir(os.path.join(app.MY_ACTIVITY_ICONSETS_PATH,
if os.path.isdir(os.path.join(configpaths.get('DATA'), 'activities', iconset)):
return os.path.join(configpaths.get('DATA'), 'activities', iconset)
elif os.path.isdir(os.path.join(configpaths.get('MY_ACTIVITY_ICONSETS'),
iconset)):
return os.path.join(app.MY_ACTIVITY_ICONSETS_PATH, iconset)
return os.path.join(configpaths.get('MY_ACTIVITY_ICONSETS'), iconset)
def get_transport_path(transport):
if os.path.isdir(os.path.join(app.DATA_DIR, 'iconsets', 'transports',
if os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', 'transports',
transport)):
return os.path.join(app.DATA_DIR, 'iconsets', 'transports', transport)
elif os.path.isdir(os.path.join(app.MY_ICONSETS_PATH, 'transports',
return os.path.join(configpaths.get('DATA'), 'iconsets', 'transports', transport)
elif os.path.isdir(os.path.join(configpaths.get('MY_ICONSETS'), 'transports',
transport)):
return os.path.join(app.MY_ICONSETS_PATH, 'transports', transport)
return os.path.join(configpaths.get('MY_ICONSETS'), 'transports', transport)
# No transport folder found, use default jabber one
return get_iconset_path(app.config.get('iconset'))
......@@ -1606,13 +1608,13 @@ def version_condition(current_version, required_version):
def get_available_emoticon_themes():
emoticons_themes = []
emoticons_data_path = os.path.join(app.DATA_DIR, 'emoticons')
emoticons_data_path = os.path.join(configpaths.get('DATA'), 'emoticons')
font_theme_path = os.path.join(
app.DATA_DIR, 'emoticons', 'font-emoticons', 'emoticons_theme.py')
configpaths.get('DATA'), 'emoticons', 'font-emoticons', 'emoticons_theme.py')
folders = os.listdir(emoticons_data_path)
if os.path.isdir(app.MY_EMOTS_PATH):
folders += os.listdir(app.MY_EMOTS_PATH)
if os.path.isdir(configpaths.get('MY_EMOTS')):
folders += os.listdir(configpaths.get('MY_EMOTS'))
file = 'emoticons_theme.py'
if os.name == 'nt' and not os.path.exists(font_theme_path):
......@@ -1628,11 +1630,11 @@ def get_available_emoticon_themes():
return emoticons_themes
def get_emoticon_theme_path(theme):
emoticons_data_path = os.path.join(app.DATA_DIR, 'emoticons', theme)
emoticons_data_path = os.path.join(configpaths.get('DATA'), 'emoticons', theme)
if os.path.exists(emoticons_data_path):
return emoticons_data_path
emoticons_user_path = os.path.join(app.MY_EMOTS_PATH, theme)
emoticons_user_path = os.path.join(configpaths.get('MY_EMOTS'), theme)
if os.path.exists(emoticons_user_path):
return emoticons_user_path
......
......@@ -19,6 +19,7 @@ Handles Jingle contents (XEP 0166)
import os
from gajim.common import app
from gajim.common import configpaths
import nbxmpp
from gajim.common.jingle_xtls import SELF_SIGNED_CERTIFICATE
from gajim.common.jingle_xtls import load_cert_file
......@@ -221,8 +222,8 @@ class JingleContent:
if self.use_security:
security = nbxmpp.simplexml.Node(
tag=nbxmpp.NS_JINGLE_XTLS + ' security')
certpath = os.path.join(app.MY_CERT_DIR, SELF_SIGNED_CERTIFICATE)\
+ '.cert'
certpath = os.path.join(
configpaths.get('MY_CERT'), SELF_SIGNED_CERTIFICATE) + '.cert'
cert = load_cert_file(certpath)
if cert:
try:
......
......@@ -21,6 +21,7 @@ import os
import nbxmpp
from gajim.common import app
from gajim.common import configpaths
log = logging.getLogger('gajim.c.jingle_xtls')
......@@ -111,18 +112,18 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
elif fingerprint == 'client':
ctx.set_verify(SSL.VERIFY_PEER, verify_cb or default_callback)
cert_name = os.path.join(app.MY_CERT_DIR, SELF_SIGNED_CERTIFICATE)
cert_name = os.path.join(configpaths.get('MY_CERT'), SELF_SIGNED_CERTIFICATE)
ctx.use_privatekey_file((cert_name + '.pkey').encode('utf-8'))
ctx.use_certificate_file((cert_name + '.cert').encode('utf-8'))
# Try to load Diffie-Hellman parameters.
# First try user DH parameters, if this fails load the default DH parameters
dh_params_name = os.path.join(app.MY_CERT_DIR, DH_PARAMS)
dh_params_name = os.path.join(configpaths.get('MY_CERT'), DH_PARAMS)
try:
with open(dh_params_name, "r") as dh_params_file:
ctx.load_tmp_dh(dh_params_name.encode('utf-8'))
except FileNotFoundError as err:
default_dh_params_name = os.path.join(app.DATA_DIR,
default_dh_params_name = os.path.join(configpaths.get('DATA'),
'other', DEFAULT_DH_PARAMS)
try:
with open(default_dh_params_name, "r") as default_dh_params_file:
......@@ -134,7 +135,7 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
if remote_jid:
store = ctx.get_cert_store()
path = os.path.join(os.path.expanduser(app.MY_PEER_CERTS_PATH),
path = os.path.join(os.path.expanduser(configpaths.get('MY_PEER_CERTS')),
remote_jid) + '.cert'
if os.path.exists(path):
load_cert_file(path, cert_store=store)
......@@ -151,7 +152,7 @@ def read_cert(certpath):
return certificate
def send_cert(con, jid_from, sid):
certpath = os.path.join(app.MY_CERT_DIR, SELF_SIGNED_CERTIFICATE) + \
certpath = os.path.join(configpaths.get('MY_CERT'), SELF_SIGNED_CERTIFICATE) + \
'.cert'
certificate = read_cert(certpath)
iq = nbxmpp.Iq('result', to=jid_from)
......@@ -170,7 +171,7 @@ def send_cert(con, jid_from, sid):
def handle_new_cert(con, obj, jid_from):
jid = app.get_jid_without_resource(jid_from)
certpath = os.path.join(os.path.expanduser(app.MY_PEER_CERTS_PATH), jid)
certpath = os.path.join(os.path.expanduser(configpaths.get('MY_PEER_CERTS')), jid)
certpath += '.cert'
id_ = obj.getAttr('id')
......@@ -188,7 +189,7 @@ def handle_new_cert(con, obj, jid_from):
approve_pending_content(id_)
def check_cert(jid, fingerprint):
certpath = os.path.join(os.path.expanduser(app.MY_PEER_CERTS_PATH), jid)
certpath = os.path.join(os.path.expanduser(configpaths.get('MY_PEER_CERTS')), jid)
certpath += '.cert'
if os.path.exists(certpath):
cert = load_cert_file(certpath)
......
......@@ -58,6 +58,7 @@ from gajim.common import app
from gajim.common import connection
from gajim.common import dataforms
from gajim.common import ged
from gajim.common import configpaths
from gajim.accounts_window import AccountsWindow
try:
......@@ -202,9 +203,10 @@ class PreferencesWindow:
self.update_theme_list()
# iconset
iconsets_list = os.listdir(os.path.join(app.DATA_DIR, 'iconsets'))
if os.path.isdir(app.MY_ICONSETS_PATH):
iconsets_list += os.listdir(app.MY_ICONSETS_PATH)
iconsets_list = os.listdir(
os.path.join(configpaths.get('DATA'), 'iconsets'))
if os.path.isdir(configpaths.get('MY_ICONSETS')):
iconsets_list += os.listdir(configpaths.get('MY_ICONSETS'))
# new model, image in 0, string in 1
model = Gtk.ListStore(Gtk.Image, str)
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
......@@ -217,8 +219,8 @@ class PreferencesWindow:
self.iconset_combobox.set_model(model)
l = []
for dir in iconsets_list:
if not os.path.isdir(os.path.join(app.DATA_DIR, 'iconsets', dir)) \
and not os.path.isdir(os.path.join(app.MY_ICONSETS_PATH, dir)):
if not os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', dir)) \
and not os.path.isdir(os.path.join(configpaths.get('MY_ICONSETS'), dir)):
continue
if dir != '.svn' and dir != 'transports':
l.append(dir)
......@@ -2292,7 +2294,8 @@ class AccountCreationWizardWindow:
self.update_proxy_list()
# parse servers.xml
servers_xml = os.path.join(app.DATA_DIR, 'other', 'servers.xml')
servers_xml = os.path.join(
configpaths.get('DATA'), 'other', 'servers.xml')
servers = gtkgui_helpers.parse_server_xml(servers_xml)
servers_model = self.xml.get_object('server_liststore')
for server in servers:
......@@ -2532,16 +2535,17 @@ class AccountCreationWizardWindow:
'hostname']
# Check if cert is already in file
certs = ''
if os.path.isfile(app.MY_CACERTS):
f = open(app.MY_CACERTS)
my_ca_certs = configpaths.get('MY_CACERTS')
if os.path.isfile(my_ca_certs):
f = open(my_ca_certs)
certs = f.read()
f.close()
if self.ssl_cert in certs:
dialogs.ErrorDialog(_('Certificate Already in File'),
_('This certificate is already in file %s, so it\'s '
'not added again.') % app.MY_CACERTS)
'not added again.') % my_ca_certs)
else:
f = open(app.MY_CACERTS, 'a')
f = open(my_ca_certs, 'a')
f.write(hostname + '\n')
f.write(self.ssl_cert + '\n\n')
f.close()
......
......@@ -52,7 +52,7 @@ from gajim.common import pep
from gajim.common import configpaths
gtk_icon_theme = Gtk.IconTheme.get_default()
gtk_icon_theme.append_search_path(app.ICONS_DIR)
gtk_icon_theme.append_search_path(configpaths.get('ICONS'))
class Color:
BLACK = Gdk.RGBA(red=0, green=0, blue=0, alpha=1)
......@@ -610,7 +610,7 @@ def get_pep_as_pixbuf(pep_class):
elif isinstance(pep_class, pep.UserTunePEP):
icon = get_icon_pixmap('audio-x-generic', quiet=True)
if not icon:
path = os.path.join(app.DATA_DIR, 'emoticons', 'static',
path = os.path.join(configpaths.get('DATA'), 'emoticons', 'static',
'music.png')
return GdkPixbuf.Pixbuf.new_from_file(path)
return icon
......
......@@ -1352,16 +1352,17 @@ class Interface:
if is_checked[0]:
# Check if cert is already in file
certs = ''
if os.path.isfile(app.MY_CACERTS):
f = open(app.MY_CACERTS)
my_ca_certs = configpaths.get('MY_CACERTS')
if os.path.isfile(my_ca_certs):
f = open(my_ca_certs)
certs = f.read()
f.close()
if obj.cert in certs:
dialogs.ErrorDialog(_('Certificate Already in File'),
_('This certificate is already in file %s, so it\'s '
'not added again.') % app.MY_CACERTS)
'not added again.') % my_ca_certs)
else:
f = open(app.MY_CACERTS, 'a')
f = open(my_ca_certs, 'a')
f.write(server + '\n')
f.write(obj.cert + '\n\n')
f.close()
......@@ -2446,14 +2447,15 @@ class Interface:
pixbuf = pixbuf.scale_simple(AvatarSize.PROFILE,
AvatarSize.PROFILE,
GdkPixbuf.InterpType.BILINEAR)
publish_path = os.path.join(app.AVATAR_PATH, 'temp_publish')
publish_path = os.path.join(
configpaths.get('AVATAR'), 'temp_publish')
pixbuf.savev(publish_path, 'png', [], [])
with open(publish_path, 'rb') as file:
data = file.read()
return self.save_avatar(data)
sha = hashlib.sha1(data).hexdigest()
path = os.path.join(app.AVATAR_PATH, sha)
path = os.path.join(configpaths.get('AVATAR'), sha)
try:
with open(path, "wb") as output_file:
output_file.write(data)
......@@ -2475,7 +2477,7 @@ class Interface:
size = size * scale
if publish:
path = os.path.join(app.AVATAR_PATH, filename)
path = os.path.join(configpaths.get('AVATAR'), filename)
with open(path, 'rb') as file:
data = file.read()
return data
......@@ -2488,7 +2490,7 @@ class Interface:
except KeyError:
pass
path = os.path.join(app.AVATAR_PATH, filename)
path = os.path.join(configpaths.get('AVATAR'), filename)
if not os.path.isfile(path):
return
......@@ -2532,7 +2534,7 @@ class Interface:
@staticmethod
def avatar_exists(filename):
path = os.path.join(app.AVATAR_PATH, filename)
path = os.path.join(configpaths.get('AVATAR'), filename)
if not os.path.isfile(path):
return False
return True
......@@ -2601,7 +2603,8 @@ class Interface:
mood = received_mood if received_mood in pep.MOODS else 'unknown'
return gtkgui_helpers.load_mood_icon(mood).get_pixbuf()
elif isinstance(pep_obj, pep.UserTunePEP):
path = os.path.join(app.DATA_DIR, 'emoticons', 'static', 'music.png')
path = os.path.join(
configpaths.get('DATA'), 'emoticons', 'static', 'music.png')
return GdkPixbuf.Pixbuf.new_from_file(path)
elif isinstance(pep_obj, pep.UserActivityPEP):
pep_ = pep_obj._pep_specific_data
......
......@@ -47,6 +47,7 @@ from gi.repository import GLib
from gi.repository import Gio
from gajim.common import i18n
from gajim.common import configpaths
def is_standalone():
......@@ -59,10 +60,6 @@ def is_standalone():
if is_standalone():
# Standalone Mode
# Must be done before importing app
from gajim.common import configpaths
try:
shortargs = 'hvsc:l:p:'
longargs = 'help verbose separate config-path= loglevel= profile='
......@@ -474,7 +471,7 @@ class HistoryManager:
dlg = xml.get_object('filechooserdialog')
dlg.set_title(_('Exporting History Logs…'))
dlg.set_current_folder(app.HOME_DIR)
dlg.set_current_folder(configpaths.get('HOME'))
dlg.props.do_overwrite_confirmation = True
response = dlg.run()
......
......@@ -27,7 +27,7 @@ Base class for implementing plugin.
import os
import locale
from gajim.common import app
from gajim.common import configpaths
from gajim.plugins.helpers import log_calls, log
from gajim.plugins.gui import GajimPluginConfigDialog
......@@ -213,7 +213,7 @@ class GajimPluginConfig():
def __init__(self, plugin):
self.plugin = plugin
self.FILE_PATH = os.path.join(
app.PLUGINS_CONFIG_DIR, self.plugin.short_name)
configpaths.get('PLUGINS_CONFIG_DIR'), self.plugin.short_name)
self.data = {}
@log_calls('GajimPluginConfig')
......
......@@ -38,6 +38,7 @@ from gajim import gtkgui_helpers
from gajim.dialogs import WarningDialog, YesNoDialog, ArchiveChooserDialog
from gajim.htmltextview import HtmlTextView
from gajim.common import app
from gajim.common import configpaths
from gajim.plugins.helpers import log_calls
from gajim.plugins.helpers import GajimPluginActivateException
from gajim.plugins.plugins_i18n import _
......@@ -161,8 +162,8 @@ class PluginsWindow(object):
self.plugin_description_textview, None)
self.plugin_description_textview.set_property('sensitive', True)
self.uninstall_plugin_button.set_property('sensitive',
app.PLUGINS_DIRS[1] in plugin.__path__)
self.uninstall_plugin_button.set_property(
'sensitive', configpaths.get('PLUGINS_USER') in plugin.__path__)
self.configure_plugin_button.set_property(
'sensitive', plugin.config_dialog is not None)
......
......@@ -36,6 +36,7 @@ from pkg_resources import parse_version
from gajim.common import app
from gajim.common import nec
from gajim.common import configpaths
from gajim.common.exceptions import PluginsystemError
from gajim.plugins.helpers import log, log_calls, Singleton
......@@ -107,7 +108,7 @@ class PluginManager(metaclass=Singleton):
Registered names with instances of encryption Plugins.
'''
for path in [app.PLUGINS_DIRS[1], app.PLUGINS_DIRS[0]]:
for path in reversed(configpaths.get('PLUGINS_DIRS')):
pc = PluginManager.scan_dir_for_plugins(path)
self.add_plugins(pc)
......@@ -534,7 +535,7 @@ class PluginManager(metaclass=Singleton):
try:
if module_name in sys.modules:
if path == app.PLUGINS_DIRS[0]:
if path == configpaths.get('PLUGINS_BASE'):
# Only reload plugins from Gajim base dir when they
# dont exist. This means plugins in the user path are
# always preferred.
......@@ -632,7 +633,7 @@ class PluginManager(metaclass=Singleton):
if len(dirs) > 1:
raise PluginsystemError(_('Archive is malformed'))
base_dir, user_dir = app.PLUGINS_DIRS
base_dir, user_dir = configpaths.get('PLUGINS_DIRS')
plugin_dir = os.path.join(user_dir, dirs[0])
if os.path.isdir(plugin_dir):
......
......@@ -23,9 +23,10 @@ import gettext
from os import path as os_path
import os
from gajim.common import app
from gajim.common import configpaths
APP = 'gajim_plugins'
plugins_locale_dir = os_path.join(app.PLUGINS_DIRS[1], 'locale')
plugins_locale_dir = os_path.join(configpaths.get('PLUGINS_USER'), 'locale')
if os.name != 'nt':
locale.setlocale(locale.LC_ALL, '')
......
......@@ -44,6 +44,7 @@ from gajim import gtkgui_helpers
from gajim.common import helpers
from gajim.common import app
from gajim.common import ged
from gajim.common import configpaths
from gajim.common.i18n import Q_
from gajim.common.const import AvatarSize
......@@ -84,7 +85,7 @@ class VcardWindow:
self.real_resource = contact.resource
puny_jid = helpers.sanitize_filename(contact.jid)
local_avatar_basepath = os.path.join(app.AVATAR_PATH, puny_jid) + \
local_avatar_basepath = os.path.join(configpaths.get('AVATAR'), puny_jid) + \
'_local'
for extension in ('.png', '.jpeg'):
local_avatar_path = local_avatar_basepath + extension
......
......@@ -47,7 +47,7 @@ def setup_env():
import logging
logging.basicConfig()
app.DATA_DIR = gajim_root + '/gajim/data'
configpaths.override_path('DATA', gajim_root + '/gajim/data')
app.use_x = use_x
app.contacts = LegacyContactsAPI()
app.connections = {}
......
......@@ -54,9 +54,8 @@ configpaths.set_config_root(configdir)
configpaths.init()
# for some reason common.app needs to be imported before xmpppy?
from gajim.common import app
app.DATA_DIR = gajim_root + '/gajim/data'
configpaths.override_path('DATA', gajim_root + '/gajim/data')
from common.stanza_session import StanzaSession
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment