Skip to content

Editor: Warn before duplicate project session (#10739)#10792

Open
calbebop wants to merge 2 commits intoFacepunch:masterfrom
calbebop:feature/10739-duplicate-project-session
Open

Editor: Warn before duplicate project session (#10739)#10792
calbebop wants to merge 2 commits intoFacepunch:masterfrom
calbebop:feature/10739-duplicate-project-session

Conversation

@calbebop
Copy link
Copy Markdown

@calbebop calbebop commented May 2, 2026

Summary

Adds a per-.sbproj session mutex so a second editor for the same project shows a Project already open dialog (Cancel / Open anyway) instead of stacking instances silently. The lock is taken early in editor startup (after LoadMinimal, before InitGame) so the prompt appears during load, not only after the main window is up. The standalone launcher checks the same lock before spawning sbox-dev.

Motivation & Context

Opening the same project in multiple editors causes confusing state and wasted work. This makes the duplicate case explicit and matches expectations for a desktop tool.

Fixes: #10739

Implementation Details

  • ProjectEditorSessionLock: SHA-256–based named mutex (Local\... on Windows), path normalization aligned with Project.AddFromFile, modal via PopupDialogWidget, release on ToolsDll.Exiting.
  • EditorAppSystem.CheckProject: acquire lock / prompt after successful LoadMinimal.
  • StartupLoadProject.OpenProject: load using normalized path; recent project list uses Project.Current.ConfigFilePath.
  • HomeWidget.OpenProject: TryConfirmLaunchFromHubBeforeSpawn before Process.Start.
  • Unit tests for mutex name stability and path normalization.

Note: A very tight race remains if two processes start before either creates the mutex; normal use and hub flow are covered.

Screenshots / Videos (if applicable)

s box-public_issue-10739

Checklist

  • Code follows existing style and conventions
  • No unnecessary formatting or unrelated changes
  • Public APIs are documented (if applicable) — internal helper only
  • Unit tests added where applicable — ProjectEditorSessionLockTests (full Sandbox.Test.Unit may require local Steam/unittest assets)
  • I’m okay with this PR being rejected or requested to change 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Launcher] Check if a project is already opened

1 participant