forked from platypush/platypush
Replaced os.environ['HOME'] with os.path.expanduser('~') (Windows compatibility)
Solves #74
This commit is contained in:
parent
1ca7feb506
commit
dcb4a36959
4 changed files with 7 additions and 7 deletions
|
@ -28,7 +28,7 @@ class Config(object):
|
|||
- /etc/platypush/config.yaml
|
||||
"""
|
||||
_cfgfile_locations = [
|
||||
os.path.join(os.environ['HOME'], '.config', 'platypush', 'config.yaml'),
|
||||
os.path.join(os.path.expanduser('~'), '.config', 'platypush', 'config.yaml'),
|
||||
os.path.join(os.sep, 'etc', 'platypush', 'config.yaml'),
|
||||
]
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Config(object):
|
|||
'now': datetime.datetime.now,
|
||||
}
|
||||
|
||||
_workdir_location = os.path.join(os.environ['HOME'], '.local', 'share', 'platypush')
|
||||
_workdir_location = os.path.join(os.path.expanduser('~'), '.local', 'share', 'platypush')
|
||||
_included_files = set()
|
||||
|
||||
def __init__(self, cfgfile=None):
|
||||
|
@ -69,7 +69,7 @@ class Config(object):
|
|||
|
||||
self._config['db'] = self._config.get('main.db', {
|
||||
'engine': 'sqlite:///' + os.path.join(
|
||||
os.environ['HOME'], '.local', 'share', 'platypush', 'main.db')
|
||||
os.path.expanduser('~'), '.local', 'share', 'platypush', 'main.db')
|
||||
})
|
||||
|
||||
logging_config = {
|
||||
|
|
|
@ -23,7 +23,7 @@ from platypush.config import Config
|
|||
from platypush.context import register_backends, get_plugin, get_backend
|
||||
|
||||
|
||||
workdir = os.path.join(os.environ['HOME'], '.local', 'share',
|
||||
workdir = os.path.join(os.path.expanduser('~'), '.local', 'share',
|
||||
'platypush', 'platydock')
|
||||
|
||||
class Action(enum.Enum):
|
||||
|
|
|
@ -130,7 +130,7 @@ class MediaPlugin(Plugin):
|
|||
|
||||
self.download_dir = os.path.abspath(os.path.expanduser(
|
||||
download_dir or player_config.get('download_dir') or
|
||||
os.path.join((os.environ['HOME'] or self._env.get('HOME') or '/'), 'Downloads')))
|
||||
os.path.join((os.path.expanduser('~') or self._env.get('HOME') or '/'), 'Downloads')))
|
||||
|
||||
if not os.path.isdir(self.download_dir):
|
||||
os.makedirs(self.download_dir, exist_ok=True)
|
||||
|
|
|
@ -276,7 +276,7 @@ class MediaWebtorrentPlugin(MediaPlugin):
|
|||
if self._media_plugin.download_dir:
|
||||
return self._media_plugin.download_dir
|
||||
else:
|
||||
d = os.path.join(os.environ['HOME'], 'Downloads')
|
||||
d = os.path.join(os.path.expanduser('~'), 'Downloads')
|
||||
os.makedirs(d, exist_ok=True)
|
||||
return d
|
||||
|
||||
|
|
Loading…
Reference in a new issue