Fix UE launch permission, move it to context menu, refresh History after Submit

- Launch now goes through a backend launch_file command (shell `start`), so
  it works for any path — fixes "Not allowed to open path" from the opener
  plugin's scoped open-path.
- Removed the toolbar Launch-Unreal button; it's now a right-click item on the
  Working folder ("Launch Unreal Engine"), shown only when a .uproject exists.
- Reload History after a successful Submit so the new changelist shows without
  a manual F5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-07-07 15:33:34 +03:00
parent d9f99bc58b
commit 2feb7ca5e1
4 changed files with 25 additions and 8 deletions

View File

@ -610,6 +610,25 @@ async fn open_in_explorer(state: State<'_, AppState>, target: String) -> Result<
Ok(())
}
/// Open a local file with its associated application (e.g. launch Unreal for a
/// `.uproject`). Uses the shell `start` so there are no path-scope restrictions.
#[tauri::command]
async fn launch_file(path: String) -> Result<(), String> {
if !std::path::Path::new(&path).exists() {
return Err(format!("File not found: {path}"));
}
let mut c = Command::new("cmd");
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
c.creation_flags(0x0800_0000);
}
c.args(["/C", "start", "", &path])
.spawn()
.map_err(|e| format!("Could not launch: {e}"))?;
Ok(())
}
/// Look for an Unreal `.uproject` inside the working-folder scope (resolved to a
/// local dir via `p4 where`). Checks the folder itself and one level of subdirs.
/// Returns the local path of the first match, or "" if the scope isn't a UE project.
@ -751,6 +770,7 @@ pub fn run() {
p4_undo_change,
open_in_explorer,
find_uproject,
launch_file,
p4_describe,
read_file,
read_depot,