Add -lastproject editor command-line option to open the last project

This commit is contained in:
2025-12-17 03:29:43 +02:00
parent 42fa0ffdd1
commit 469a422681
3 changed files with 13 additions and 0 deletions

View File

@@ -537,6 +537,13 @@ int32 Editor::LoadProduct()
if (FileSystem::FileExists(lastProjectSettingPath))
File::ReadAllText(lastProjectSettingPath, lastProjectPath);
// Try to open the last project when requested
if (projectPath.IsEmpty() && CommandLine::Options.LastProject.IsTrue())
{
if (!lastProjectPath.IsEmpty() && FileSystem::DirectoryExists(lastProjectPath))
projectPath = lastProjectPath;
}
// Missing project case
if (projectPath.IsEmpty())
{

View File

@@ -155,6 +155,7 @@ bool CommandLine::Parse(const Char* cmdLine)
PARSE_BOOL_SWITCH("-clearcache ", ClearCache);
PARSE_BOOL_SWITCH("-clearcooker ", ClearCookerCache);
PARSE_ARG_SWITCH("-project ", Project);
PARSE_BOOL_SWITCH("-lastproject ", LastProject);
PARSE_BOOL_SWITCH("-new ", NewProject);
PARSE_BOOL_SWITCH("-genprojectfiles ", GenProjectFiles);
PARSE_ARG_SWITCH("-build ", Build);

View File

@@ -147,6 +147,11 @@ public:
/// </summary>
String Project;
/// <summary>
/// -lastproject (Opens the last project)
/// </summary>
Nullable<bool> LastProject;
/// <summary>
/// -new (generates the project files inside the specified project folder or uses current workspace folder)
/// </summary>