diff --git a/Source/Editor/Editor.cpp b/Source/Editor/Editor.cpp
index 92c15f591..e82be1128 100644
--- a/Source/Editor/Editor.cpp
+++ b/Source/Editor/Editor.cpp
@@ -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())
{
diff --git a/Source/Engine/Engine/CommandLine.cpp b/Source/Engine/Engine/CommandLine.cpp
index e0f9441eb..ad2c9c903 100644
--- a/Source/Engine/Engine/CommandLine.cpp
+++ b/Source/Engine/Engine/CommandLine.cpp
@@ -149,6 +149,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);
diff --git a/Source/Engine/Engine/CommandLine.h b/Source/Engine/Engine/CommandLine.h
index ad49bee04..0464a478f 100644
--- a/Source/Engine/Engine/CommandLine.h
+++ b/Source/Engine/Engine/CommandLine.h
@@ -133,6 +133,11 @@ public:
///
String Project;
+ ///
+ /// -lastproject (Opens the last project)
+ ///
+ Nullable LastProject;
+
///
/// -new (generates the project files inside the specified project folder or uses current workspace folder)
///