def save(self):
config_file = RelativePathResolver().absolute("config.json")
try:
# Check if file exists (supports also hidden files)
if os.path.isfile(config_file):
# Use write mode that also works with hidden files
with open(os.open(config_file, os.O_WRONLY | os.O_TRUNC), 'w') as file:
json.dump(self.serialize(), file)
else:
# Simply create a new file
with open(config_file, "w") as file:
json.dump(self.serialize(), file)
except IOError:
pass
评论列表
文章目录