Skip to content

Commit 5886d5f

Browse files
dooly123claude
andcommitted
Installs: Open button opens the Unity project, not the folder
The Projects list's Open action now launches the install's Unity project (the resolved Basis/Basis subfolder) in the editor matching its ProjectVersion, reusing the shell OpenProjectInUnityAsync path, which falls back to Unity Hub when that version isn't installed. Relabeled to Open in Unity and shown only when a Unity project is detected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent dbab97b commit 5886d5f

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/BasisPM.App/ViewModels/InstallsViewModel.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public string? CloneSpaceWarning
6161
public RelayCommand RefreshCommand { get; }
6262
public RelayCommand<InstallRow> UpdateCoreCommand { get; }
6363
public RelayCommand<InstallRow> CheckUpdatesCommand { get; }
64-
public RelayCommand<InstallRow> OpenFolderCommand { get; }
64+
public RelayCommand<InstallRow> OpenInUnityCommand { get; }
6565
public RelayCommand<InstallRow> ManagePackagesCommand { get; }
6666
public RelayCommand<InstallRow> ViewChangesCommand { get; }
6767
public RelayCommand<InstallRow> RemoveCommand { get; }
@@ -82,7 +82,7 @@ public InstallsViewModel(UserSettingsService settingsService, BasisInstallServic
8282
RefreshCommand = new RelayCommand(RefreshAsync);
8383
UpdateCoreCommand = new RelayCommand<InstallRow>(UpdateCoreAsync);
8484
CheckUpdatesCommand = new RelayCommand<InstallRow>(r => RefreshGitInfoAsync(r, fetch: true));
85-
OpenFolderCommand = new RelayCommand<InstallRow>(OpenFolder);
85+
OpenInUnityCommand = new RelayCommand<InstallRow>(OpenInUnity);
8686
ManagePackagesCommand = new RelayCommand<InstallRow>(r => Activate(r, "packages"));
8787
ViewChangesCommand = new RelayCommand<InstallRow>(r => Activate(r, "changes"));
8888
RemoveCommand = new RelayCommand<InstallRow>(RemoveAsync);
@@ -455,15 +455,13 @@ private async Task BrowseCloneFolderAsync()
455455
}
456456
}
457457

458-
private void OpenFolder(InstallRow? row)
458+
// Launches the install's Unity project — the resolved Basis/Basis subfolder (install.UnityProjectPath) —
459+
// in the editor matching its ProjectVersion, falling back to Unity Hub when that version isn't installed.
460+
// The shell method reports its own status and handles the "no Unity project" case.
461+
private void OpenInUnity(InstallRow? row)
459462
{
460463
if (row is null) return;
461-
if (!Directory.Exists(row.RepoRoot))
462-
{
463-
_shell.SetStatus(L.Tr("installs.status.folderMissing", row.RepoRoot), StatusKind.Error);
464-
return;
465-
}
466-
BasisPM.App.Services.ExternalLink.OpenFolder(row.RepoRoot);
464+
_ = _shell.OpenProjectInUnityAsync(row.Install);
467465
}
468466

469467
private async Task RemoveAsync(InstallRow? row)

src/BasisPM.App/Views/InstallsView.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130
<Button Content="{loc:Tr installs.button.changes}"
131131
Command="{Binding #Root.((vm:InstallsViewModel)DataContext).ViewChangesCommand}"
132132
CommandParameter="{Binding}"/>
133-
<Button Content="{loc:Tr installs.button.open}"
134-
Command="{Binding #Root.((vm:InstallsViewModel)DataContext).OpenFolderCommand}"
133+
<Button Content="{loc:Tr develop.button.openInUnity}" IsVisible="{Binding HasUnityProject}"
134+
Command="{Binding #Root.((vm:InstallsViewModel)DataContext).OpenInUnityCommand}"
135135
CommandParameter="{Binding}"/>
136136
<Button Content="{loc:Tr installs.button.backup}" IsVisible="{Binding HasUnityProject}"
137137
Command="{Binding #Root.((vm:InstallsViewModel)DataContext).BackupCommand}"

0 commit comments

Comments
 (0)