~/.config is created if it does not already exist

This commit is contained in:
2022-01-16 23:41:29 -05:00
parent 6e13a6ebb3
commit 4973d18034
2 changed files with 4 additions and 9 deletions
+3 -5
View File
@@ -4,19 +4,17 @@
# external modules # external modules
from os import system, remove, mkdir, walk from os import mkdir, path, remove, system, walk
from os.path import getmtime, join, expanduser from os.path import getmtime, join, expanduser
from sys import exit as s_exit from sys import exit as s_exit
from pathlib import Path
# utility functions # utility functions
def get_titles_mods(_directory, _destination, _user_data): def get_titles_mods(_directory, _destination, _user_data):
_title_list, _mod_list = [], [] _title_list, _mod_list = [], []
try: # create config directory Path(path.expanduser('~/.config/sshync')).mkdir(0o700, parents=True, exist_ok=True) # create config directory
mkdir(expanduser('~/.config/sshync'), 0o700)
except FileExistsError:
pass
# local fetching # local fetching
if _destination == 'l': if _destination == 'l':
remove(expanduser('~/.config/sshync/database')) # assumed to exist because remote runs first remove(expanduser('~/.config/sshync/database')) # assumed to exist because remote runs first
+1 -4
View File
@@ -52,10 +52,7 @@ def tweak(): # runs configuration wizard
mkdir(path.expanduser('~/.password-pasture'), 0o700) mkdir(path.expanduser('~/.password-pasture'), 0o700)
except FileExistsError: except FileExistsError:
pass pass
try: Path(path.expanduser('~/.config/sshyp')).mkdir(0o700, parents=True, exist_ok=True)
mkdir(path.expanduser('~/.config/sshyp'), 0o700)
except FileExistsError:
pass
if not Path(f"{path.expanduser('~/.config/sshyp/tmp')}").exists(): if not Path(f"{path.expanduser('~/.config/sshyp/tmp')}").exists():
if Path("/data/data/com.termux").exists(): if Path("/data/data/com.termux").exists():
system(f"ln -s '/data/data/com.termux/files/usr/tmp' {path.expanduser('~/.config/sshyp/tmp')}") system(f"ln -s '/data/data/com.termux/files/usr/tmp' {path.expanduser('~/.config/sshyp/tmp')}")