Restore opening existing projects with -new
This commit is contained in:
@@ -406,13 +406,28 @@ int32 Editor::LoadProduct()
|
|||||||
if (CommandLine::Options.NewProject)
|
if (CommandLine::Options.NewProject)
|
||||||
{
|
{
|
||||||
Array<String> projectFiles;
|
Array<String> projectFiles;
|
||||||
FileSystem::DirectoryGetFiles(projectFiles, projectPath, TEXT("*"), DirectorySearchOption::TopDirectoryOnly);
|
FileSystem::DirectoryGetFiles(projectFiles, projectPath, TEXT("*.flaxproj"), DirectorySearchOption::TopDirectoryOnly);
|
||||||
if (projectFiles.Count() > 0)
|
if (projectFiles.Count() > 1)
|
||||||
|
{
|
||||||
|
Platform::Fatal(TEXT("Too many project files."));
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
else if (projectFiles.Count() == 1)
|
||||||
|
{
|
||||||
|
LOG(Info, "Skip creating new project because it already exists");
|
||||||
|
CommandLine::Options.NewProject.Reset();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Array<String> files;
|
||||||
|
FileSystem::DirectoryGetFiles(files, projectPath, TEXT("*"), DirectorySearchOption::TopDirectoryOnly);
|
||||||
|
if (files.Count() > 0)
|
||||||
{
|
{
|
||||||
Platform::Fatal(String::Format(TEXT("Target project folder '{0}' is not empty."), projectPath));
|
Platform::Fatal(String::Format(TEXT("Target project folder '{0}' is not empty."), projectPath));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (CommandLine::Options.NewProject)
|
if (CommandLine::Options.NewProject)
|
||||||
{
|
{
|
||||||
if (projectPath.IsEmpty())
|
if (projectPath.IsEmpty())
|
||||||
|
|||||||
Reference in New Issue
Block a user