mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-22 11:00:16 +10:00
Merge branch 'main' into ventura-alpha
This commit is contained in:
@@ -21,15 +21,17 @@ class global_settings:
|
|||||||
plistlib.dump({"Developed by Dortania": True,}, Path(self.global_settings_plist).open("wb"))
|
plistlib.dump({"Developed by Dortania": True,}, Path(self.global_settings_plist).open("wb"))
|
||||||
|
|
||||||
def read_property(self, property_name):
|
def read_property(self, property_name):
|
||||||
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
if Path(self.global_settings_plist).exists():
|
||||||
if property_name in plist:
|
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
||||||
return plist[property_name]
|
if property_name in plist:
|
||||||
|
return plist[property_name]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def write_property(self, property_name, property_value):
|
def write_property(self, property_name, property_value):
|
||||||
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
if Path(self.global_settings_plist).exists():
|
||||||
plist[property_name] = property_value
|
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
||||||
plistlib.dump(plist, Path(self.global_settings_plist).open("wb"))
|
plist[property_name] = property_value
|
||||||
|
plistlib.dump(plist, Path(self.global_settings_plist).open("wb"))
|
||||||
|
|
||||||
|
|
||||||
def convert_defaults_to_global_settings(self):
|
def convert_defaults_to_global_settings(self):
|
||||||
@@ -41,7 +43,11 @@ class global_settings:
|
|||||||
# merge defaults with global settings
|
# merge defaults with global settings
|
||||||
global_settings_plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
global_settings_plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
||||||
global_settings_plist.update(defaults_plist)
|
global_settings_plist.update(defaults_plist)
|
||||||
plistlib.dump(global_settings_plist, Path(self.global_settings_plist).open("wb"))
|
try:
|
||||||
|
plistlib.dump(global_settings_plist, Path(self.global_settings_plist).open("wb"))
|
||||||
|
except PermissionError:
|
||||||
|
print("- Permission error: Unable to write to global settings file")
|
||||||
|
return
|
||||||
|
|
||||||
# delete defaults plist
|
# delete defaults plist
|
||||||
Path(defaults_path).unlink()
|
Path(defaults_path).unlink()
|
||||||
Reference in New Issue
Block a user