Browse Source

Change config path as suggested on issue #10

LINUX: ~/.config/youtube-dlg/
WINDOWS: %APPDATA%\youtube-dlg\
doc-issue-template
MrS0m30n3 10 years ago
parent
commit
c46446a364
2 changed files with 12 additions and 5 deletions
  1. 10
      youtube_dl_gui/OptionsHandler.py
  2. 7
      youtube_dl_gui/Utils.py

10
youtube_dl_gui/OptionsHandler.py

@ -2,7 +2,10 @@
import json
from data import __appname__
from .Utils import (
get_user_config_path,
get_HOME,
file_exist,
os_type,
@ -11,8 +14,7 @@ from .Utils import (
)
SETTINGS_FILENAME = 'settings.json'
LINUX_FILES_PATH = get_HOME() + '/.youtube-dl-gui'
WINDOWS_FILES_PATH = get_HOME() + '\\youtube-dl-gui'
CONFIG_PATH = fix_path(get_user_config_path()) + __appname__.lower()
class OptionsHandler():
@ -73,9 +75,7 @@ class OptionsHandler():
}
def get_config_path(self):
if os_type == 'nt':
return WINDOWS_FILES_PATH
return LINUX_FILES_PATH
return CONFIG_PATH
def set_settings_path(self):
self.settings_abs_path = fix_path(self.get_config_path()) + SETTINGS_FILENAME

7
youtube_dl_gui/Utils.py

@ -86,6 +86,13 @@ def check_path(path):
if not file_exist(path):
makedir(path)
def get_user_config_path():
if os_type == 'nt':
path = os.getenv('APPDATA')
else:
path = fix_path(get_HOME()) + '.config'
return path
def shutdown_sys(password=''):
if os_type == 'nt':
subprocess.call(['shutdown', '/s', '/t', '1'])

Loading…
Cancel
Save