Philipp Hörist pushed to branch master at gajim / gajim

Commits:

3 changed files:

Changes:

  • gajim/__init__.py
    1
    -import os
    
    2 1
     import subprocess
    
    2
    +import sys
    
    3
    +from pathlib import Path
    
    3 4
     
    
    4 5
     __version__ = "1.2.91"
    
    5 6
     
    
    6
    -IS_FLATPAK = False
    
    7
    -if os.path.exists('/app/share/run-as-flatpak'):
    
    8
    -    IS_FLATPAK = True
    
    7
    +IS_FLATPAK = Path('/app/share/run-as-flatpak').exists()
    
    9 8
     
    
    10
    -IS_PORTABLE = False
    
    11
    -portable_path = os.path.join(os.getcwd(), 'is_portable')
    
    12
    -if os.path.exists(portable_path):
    
    13
    -    IS_PORTABLE = True
    
    9
    +portable_path = Path(sys.executable).parent / 'is_portable'
    
    10
    +IS_PORTABLE = portable_path.exists()
    
    14 11
     
    
    15 12
     try:
    
    16 13
         p = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True,
    

  • gajim/common/configpaths.py
    ... ... @@ -105,13 +105,14 @@ def __init__(self) -> None:
    105 105
             self.custom_config_root = None  # type: Optional[Path]
    
    106 106
     
    
    107 107
             if os.name == 'nt':
    
    108
    -            try:
    
    108
    +            if gajim.IS_PORTABLE:
    
    109
    +                application_path = Path(sys.executable).parent
    
    110
    +                self.config_root = self.cache_root = self.data_root = \
    
    111
    +                        application_path.parent / 'UserData'
    
    112
    +            else:
    
    109 113
                     # Documents and Settings\[User Name]\Application Data\Gajim
    
    110 114
                     self.config_root = self.cache_root = self.data_root = \
    
    111 115
                             Path(os.environ['appdata']) / 'Gajim'
    
    112
    -            except KeyError:
    
    113
    -                # win9x, in cwd
    
    114
    -                self.config_root = self.cache_root = self.data_root = Path('.')
    
    115 116
             else:
    
    116 117
                 self.config_root = Path(GLib.get_user_config_dir()) / 'gajim'
    
    117 118
                 self.cache_root = Path(GLib.get_user_cache_dir()) / 'gajim'
    

  • win/misc/gajim-portable.nsi
    ... ... @@ -105,9 +105,9 @@ Section "Gajim" SecGajim
    105 105
     
    
    106 106
         SetOutPath "$INSTDIR\bin"
    
    107 107
         CreateShortCut "$INSTDIR\Gajim-Portable.lnk" "$INSTDIR\bin\Gajim.exe" \
    
    108
    -    "-c ..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable"
    
    108
    +    "" "" "" SW_SHOWNORMAL "" "Gajim Portable"
    
    109 109
         CreateShortCut "$INSTDIR\Gajim-Portable-Debug.lnk" "$INSTDIR\bin\Gajim-Debug.exe" \
    
    110
    -    "-c ..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable Debug"
    
    110
    +    "" "" "" SW_SHOWNORMAL "" "Gajim Portable Debug"
    
    111 111
         FileOpen $0 "is_portable" w
    
    112 112
         FileClose $0
    
    113 113