Feat/configurable paths (#404)

This commit is contained in:
suchmememanyskill
2023-04-25 05:12:42 +02:00
committed by GitHub
parent 4777963b65
commit d6f336d84b
8 changed files with 140 additions and 45 deletions
+4 -5
View File
@@ -1,6 +1,6 @@
from json import dump, load
from os import mkdir, path, listdir, rename
from localplatform import chown, folder_owner
from localplatform import chown, folder_owner, get_chown_plugin_path
from customtypes import UserType
from helpers import get_homebrew_path
@@ -17,7 +17,6 @@ class SettingsManager:
#Create the folder with the correct permission
if not path.exists(settings_directory):
mkdir(settings_directory)
chown(settings_directory)
#Copy all old settings file in the root directory to the correct folder
for file in listdir(wrong_dir):
@@ -28,9 +27,9 @@ class SettingsManager:
#If the owner of the settings directory is not the user, then set it as the user:
if folder_owner(settings_directory) != UserType.HOST_USER:
chown(settings_directory, UserType.HOST_USER, False)
expected_user = UserType.HOST_USER if get_chown_plugin_path() else UserType.ROOT
if folder_owner(settings_directory) != expected_user:
chown(settings_directory, expected_user, False)
self.settings = {}