diff --git a/SABnzbd.py b/SABnzbd.py index da2cee9..c27efc6 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -918,7 +918,7 @@ def main(): # No ini file given, need profile data get_user_profile_paths(vista_plus) # Find out where INI file is - inifile = os.path.abspath(sabnzbd.DIR_LCLDATA + '/' + DEF_INI_FILE) + inifile = os.path.abspath(os.path.join(sabnzbd.DIR_LCLDATA, DEF_INI_FILE)) # Long-path notation on Windows to be sure inifile = long_path(inifile) diff --git a/sabnzbd/api.py b/sabnzbd/api.py index 5d64cd5..f59785e 100644 --- a/sabnzbd/api.py +++ b/sabnzbd/api.py @@ -1176,11 +1176,11 @@ def build_status(skip_dashboard=False, output=None): info['pystone'] = sabnzbd.PYSTONE_SCORE # Dashboard: Speed of Download directory: - info['downloaddir'] = clip_path(cfg.download_dir.get_path()) + info['downloaddir'] = cfg.download_dir.get_clipped_path() info['downloaddirspeed'] = sabnzbd.DOWNLOAD_DIR_SPEED # Dashboard: Speed of Complete directory: - info['completedir'] = clip_path(cfg.complete_dir.get_path()) + info['completedir'] = cfg.complete_dir.get_clipped_path() info['completedirspeed'] = sabnzbd.COMPLETE_DIR_SPEED # Dashboard: Connection information diff --git a/sabnzbd/config.py b/sabnzbd/config.py index 7040a06..4be64c9 100644 --- a/sabnzbd/config.py +++ b/sabnzbd/config.py @@ -207,6 +207,10 @@ class OptionDir(Option): res, path = sabnzbd.filesystem.create_real_path(self.ident()[1], self.__root, value, self.__apply_umask, self.__writable) return path + def get_clipped_path(self): + """ Return clipped full absolute path """ + return sabnzbd.filesystem.clip_path(self.get_path()) + def test_path(self): """ Return True if path exists """ value = self.get() diff --git a/sabnzbd/constants.py b/sabnzbd/constants.py index fd0c8d5..8522437 100644 --- a/sabnzbd/constants.py +++ b/sabnzbd/constants.py @@ -15,6 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +import os from collections import namedtuple from re import compile @@ -56,8 +57,8 @@ SABYENC_VERSION_REQUIRED = '0.1.1' DB_HISTORY_VERSION = 1 DB_HISTORY_NAME = 'history%s.db' % DB_HISTORY_VERSION -DEF_DOWNLOAD_DIR = 'Downloads/incomplete' -DEF_COMPLETE_DIR = 'Downloads/complete' +DEF_DOWNLOAD_DIR = os.path.normpath('Downloads/incomplete') +DEF_COMPLETE_DIR = os.path.normpath('Downloads/complete') DEF_ADMIN_DIR = 'admin' DEF_NZBBACK_DIR = '' DEF_LANGUAGE = 'locale' @@ -66,7 +67,7 @@ DEF_EMAIL_TMPL = 'email' DEF_STDCONFIG = 'Config' DEF_STDINTF = 'Glitter' DEF_SKIN_COLORS = {'Glitter': 'Default', 'plush': 'gold'} -DEF_MAIN_TMPL = 'templates/main.tmpl' +DEF_MAIN_TMPL = os.path.normpath('templates/main.tmpl') DEF_INI_FILE = 'sabnzbd.ini' DEF_HOST = '127.0.0.1' DEF_PORT = 8080 diff --git a/sabnzbd/interface.py b/sabnzbd/interface.py index 2d749a0..280db2a 100644 --- a/sabnzbd/interface.py +++ b/sabnzbd/interface.py @@ -597,8 +597,8 @@ class Wizard(object): info = build_header(sabnzbd.WIZARD_DIR) info['access_url'], info['urls'] = get_access_info() - info['download_dir'] = cfg.download_dir.get_path() - info['complete_dir'] = cfg.complete_dir.get_path() + info['download_dir'] = cfg.download_dir.get_clipped_path() + info['complete_dir'] = cfg.complete_dir.get_clipped_path() template = Template(file=os.path.join(sabnzbd.WIZARD_DIR, 'two.html'), searchList=[info], compilerSettings=CHEETAH_DIRECTIVES) @@ -1425,7 +1425,7 @@ class ConfigGeneral(object): for web in interfaces: rweb = os.path.basename(web) - if os.access(web + '/' + DEF_MAIN_TMPL, os.R_OK): + if os.access(os.path.join(web, DEF_MAIN_TMPL), os.R_OK): cols = ListColors(rweb) if cols: for col in cols: @@ -1449,7 +1449,7 @@ class ConfigGeneral(object): conf['bandwidth_perc'] = cfg.bandwidth_perc() conf['nzb_key'] = cfg.nzb_key() conf['local_ranges'] = cfg.local_ranges.get_string() - conf['my_lcldata'] = cfg.admin_dir.get_path() + conf['my_lcldata'] = cfg.admin_dir.get_clipped_path() conf['caller_url'] = cherrypy.request.base + cfg.url_base() template = Template(file=os.path.join(sabnzbd.WEB_DIR_CONFIG, 'config_general.tmpl'), @@ -2174,7 +2174,7 @@ class ConfigCats(object): conf = build_header(sabnzbd.WEB_DIR_CONFIG) conf['scripts'] = list_scripts(default=True) - conf['defdir'] = cfg.complete_dir.get_path() + conf['defdir'] = cfg.complete_dir.get_clipped_path() categories = config.get_ordered_categories() conf['have_cats'] = len(categories) > 1 @@ -2237,7 +2237,7 @@ class ConfigSorting(object): @secured_expose(check_configlock=True) def index(self, **kwargs): conf = build_header(sabnzbd.WEB_DIR_CONFIG) - conf['complete_dir'] = cfg.complete_dir.get_path() + conf['complete_dir'] = cfg.complete_dir.get_clipped_path() for kw in SORT_LIST: conf[kw] = config.get_config('misc', kw)()