index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | advaithm <advaith.madhukar@gmail.com> | 2021-04-02 09:48:41 +0530 |
---|---|---|
committer | advaithm <advaith.madhukar@gmail.com> | 2021-04-02 09:48:41 +0530 |
commit | f4e616cd9e1328a83fdf6f1541fd495292474642 (patch) | |
tree | 605a932306254bec6a232888791897a1eb099ef2 /archinstall/lib/output.py | |
parent | 72284e2b2a96f4c8c6603f3a900b956121253b92 (diff) | |
parent | 2c90f02b6b26cc489e90f7536fe8931a4b2b9195 (diff) |
-rw-r--r-- | archinstall/lib/output.py | 12 |
diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py index 0e0a295b..537fb695 100644 --- a/archinstall/lib/output.py +++ b/archinstall/lib/output.py @@ -96,7 +96,17 @@ def log(*args, **kwargs): if (filename := storage.get('LOG_FILE', None)): absolute_logfile = os.path.join(storage.get('LOG_PATH', './'), filename) if not os.path.isfile(absolute_logfile): - os.makedirs(os.path.dirname(absolute_logfile)) + try: + Path(absolute_logfile).parents[0].mkdir(exist_ok=True, parents=True) + except PermissionError: + # Fallback to creating the log file in the current folder + err_string = f"Not enough permission to place log file at {absolute_logfile}, creating it in {Path('./').absolute()/filename} instead." + absolute_logfile = Path('./').absolute()/filename + absolute_logfile.parents[0].mkdir(exist_ok=True) + absolute_logfile = str(absolute_logfile) + storage['LOG_PATH'] = './' + log(err_string, fg="red") + Path(absolute_logfile).touch() # Overkill? with open(absolute_logfile, 'a') as log_file: |