solved overwritting bug
This commit is contained in:
14
main.py
14
main.py
@@ -673,17 +673,13 @@ For detailed help on each command, use:
|
|||||||
if not selected:
|
if not selected:
|
||||||
print("No repositories selected.")
|
print("No repositories selected.")
|
||||||
else:
|
else:
|
||||||
# Ermittele die Identifier aller ausgewählter Repositories.
|
|
||||||
identifiers = [get_repo_identifier(repo, all_repos_list) for repo in selected]
|
identifiers = [get_repo_identifier(repo, all_repos_list) for repo in selected]
|
||||||
sorted_identifiers = sorted(identifiers)
|
sorted_identifiers = sorted(identifiers)
|
||||||
# Erstelle den Workspace-Dateinamen, z. B.: repo1_repo2_repo3.code-workspace
|
|
||||||
workspace_name = "_".join(sorted_identifiers) + ".code-workspace"
|
workspace_name = "_".join(sorted_identifiers) + ".code-workspace"
|
||||||
# Hole den Workspaces-Ordner aus der Config.
|
|
||||||
workspaces_dir = os.path.expanduser(config_merged.get("directories").get("workspaces"))
|
workspaces_dir = os.path.expanduser(config_merged.get("directories").get("workspaces"))
|
||||||
os.makedirs(workspaces_dir, exist_ok=True)
|
os.makedirs(workspaces_dir, exist_ok=True)
|
||||||
workspace_file = os.path.join(workspaces_dir, workspace_name)
|
workspace_file = os.path.join(workspaces_dir, workspace_name)
|
||||||
|
|
||||||
# Erstelle die Workspace-Konfiguration mit allen Repositories als Folder-Eintrag.
|
|
||||||
folders = []
|
folders = []
|
||||||
for repo in selected:
|
for repo in selected:
|
||||||
repo_dir = os.path.expanduser(get_repo_dir(repositories_base_dir, repo))
|
repo_dir = os.path.expanduser(get_repo_dir(repositories_base_dir, repo))
|
||||||
@@ -693,9 +689,13 @@ For detailed help on each command, use:
|
|||||||
"folders": folders,
|
"folders": folders,
|
||||||
"settings": {}
|
"settings": {}
|
||||||
}
|
}
|
||||||
with open(workspace_file, "w") as f:
|
|
||||||
json.dump(workspace_data, f, indent=4)
|
if not os.path.exists(workspace_file):
|
||||||
print(f"Created workspace file: {workspace_file}")
|
with open(workspace_file, "w") as f:
|
||||||
|
json.dump(workspace_data, f, indent=4)
|
||||||
|
print(f"Created workspace file: {workspace_file}")
|
||||||
|
else:
|
||||||
|
print(f"Using existing workspace file: {workspace_file}")
|
||||||
run_command(f'code "{workspace_file}"')
|
run_command(f'code "{workspace_file}"')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user