Fix issue with save config
This commit is contained in:
parent
758bfe85dc
commit
dfc9a8dd40
@ -122,6 +122,13 @@ def save_configuration(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Extract the destination directory from the file path
|
||||||
|
destination_directory = os.path.dirname(file_path)
|
||||||
|
|
||||||
|
# Create the destination directory if it doesn't exist
|
||||||
|
if not os.path.exists(destination_directory):
|
||||||
|
os.makedirs(destination_directory)
|
||||||
|
|
||||||
# Save the data to the selected file
|
# Save the data to the selected file
|
||||||
with open(file_path, 'w') as file:
|
with open(file_path, 'w') as file:
|
||||||
json.dump(variables, file, indent=2)
|
json.dump(variables, file, indent=2)
|
||||||
|
@ -104,8 +104,8 @@ def save_configuration(
|
|||||||
|
|
||||||
# print(file_path)
|
# print(file_path)
|
||||||
|
|
||||||
if file_path == None:
|
if file_path == None or file_path == '':
|
||||||
return original_file_path
|
return original_file_path # In case a file_path was provided and the user decide to cancel the open action
|
||||||
|
|
||||||
# Return the values of the variables as a dictionary
|
# Return the values of the variables as a dictionary
|
||||||
variables = {
|
variables = {
|
||||||
@ -118,6 +118,13 @@ def save_configuration(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Extract the destination directory from the file path
|
||||||
|
destination_directory = os.path.dirname(file_path)
|
||||||
|
|
||||||
|
# Create the destination directory if it doesn't exist
|
||||||
|
if not os.path.exists(destination_directory):
|
||||||
|
os.makedirs(destination_directory)
|
||||||
|
|
||||||
# Save the data to the selected file
|
# Save the data to the selected file
|
||||||
with open(file_path, 'w') as file:
|
with open(file_path, 'w') as file:
|
||||||
json.dump(variables, file, indent=2)
|
json.dump(variables, file, indent=2)
|
||||||
|
@ -133,6 +133,13 @@ def save_configuration(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Extract the destination directory from the file path
|
||||||
|
destination_directory = os.path.dirname(file_path)
|
||||||
|
|
||||||
|
# Create the destination directory if it doesn't exist
|
||||||
|
if not os.path.exists(destination_directory):
|
||||||
|
os.makedirs(destination_directory)
|
||||||
|
|
||||||
# Save the data to the selected file
|
# Save the data to the selected file
|
||||||
with open(file_path, 'w') as file:
|
with open(file_path, 'w') as file:
|
||||||
json.dump(variables, file, indent=2)
|
json.dump(variables, file, indent=2)
|
||||||
|
@ -117,10 +117,6 @@ def save_configuration(
|
|||||||
if file_path == None or file_path == '':
|
if file_path == None or file_path == '':
|
||||||
return original_file_path # In case a file_path was provided and the user decide to cancel the open action
|
return original_file_path # In case a file_path was provided and the user decide to cancel the open action
|
||||||
|
|
||||||
directory = os.path.dirname(file_path)
|
|
||||||
if not os.path.exists(directory):
|
|
||||||
os.makedirs(directory)
|
|
||||||
|
|
||||||
# Return the values of the variables as a dictionary
|
# Return the values of the variables as a dictionary
|
||||||
variables = {
|
variables = {
|
||||||
name: value
|
name: value
|
||||||
@ -132,6 +128,13 @@ def save_configuration(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Extract the destination directory from the file path
|
||||||
|
destination_directory = os.path.dirname(file_path)
|
||||||
|
|
||||||
|
# Create the destination directory if it doesn't exist
|
||||||
|
if not os.path.exists(destination_directory):
|
||||||
|
os.makedirs(destination_directory)
|
||||||
|
|
||||||
# Save the data to the selected file
|
# Save the data to the selected file
|
||||||
with open(file_path, 'w') as file:
|
with open(file_path, 'w') as file:
|
||||||
json.dump(variables, file, indent=2)
|
json.dump(variables, file, indent=2)
|
||||||
|
Loading…
Reference in New Issue
Block a user