Merge branch 'GoaLitiuM-new_project_fix'
This commit is contained in:
@@ -407,12 +407,26 @@ int32 Editor::LoadProduct()
|
|||||||
{
|
{
|
||||||
Array<String> projectFiles;
|
Array<String> projectFiles;
|
||||||
FileSystem::DirectoryGetFiles(projectFiles, projectPath, TEXT("*.flaxproj"), DirectorySearchOption::TopDirectoryOnly);
|
FileSystem::DirectoryGetFiles(projectFiles, projectPath, TEXT("*.flaxproj"), DirectorySearchOption::TopDirectoryOnly);
|
||||||
if (projectFiles.Count() == 1)
|
if (projectFiles.Count() > 1)
|
||||||
{
|
{
|
||||||
// Skip creating new project if it already exists
|
Platform::Fatal(TEXT("Too many project files."));
|
||||||
LOG(Info, "Skip creatinng new project because it already exists");
|
return -2;
|
||||||
|
}
|
||||||
|
else if (projectFiles.Count() == 1)
|
||||||
|
{
|
||||||
|
LOG(Info, "Skip creating new project because it already exists");
|
||||||
CommandLine::Options.NewProject.Reset();
|
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));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (CommandLine::Options.NewProject)
|
if (CommandLine::Options.NewProject)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ class FLAXENGINE_API Win32FileSystem : public FileSystemBase
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// Creates a new directory
|
// Creates a new directory
|
||||||
// @param path Drectory path
|
// @param path Directory path
|
||||||
// @returns True if cannot create directory, otherwise false
|
// @returns True if cannot create directory, otherwise false
|
||||||
static bool CreateDirectory(const StringView& path);
|
static bool CreateDirectory(const StringView& path);
|
||||||
|
|
||||||
// Deletes an existing directory
|
// Deletes an existing directory
|
||||||
// @param path Drectory path
|
// @param path Directory path
|
||||||
// @param deleteSubdirectories True if delete all subdirectories and files, otherwise false
|
// @param deleteSubdirectories True if delete all subdirectories and files, otherwise false
|
||||||
// @returns True if cannot delete directory, otherwise false
|
// @returns True if cannot delete directory, otherwise false
|
||||||
static bool DeleteDirectory(const String& path, bool deleteContents = true);
|
static bool DeleteDirectory(const String& path, bool deleteContents = true);
|
||||||
@@ -32,15 +32,15 @@ public:
|
|||||||
static bool DirectoryExists(const StringView& path);
|
static bool DirectoryExists(const StringView& path);
|
||||||
|
|
||||||
// Finds the names of files (including their paths) that match the specified search pattern in the specified directory, using a value to determine whether to search subdirectories
|
// Finds the names of files (including their paths) that match the specified search pattern in the specified directory, using a value to determine whether to search subdirectories
|
||||||
// @param results When this metod completes, this list contains list of all filenames that match the specified search pattern
|
// @param results When this method completes, this list contains list of all filenames that match the specified search pattern
|
||||||
// @param path Path of the directory to search in it
|
// @param path Path of the directory to search in it
|
||||||
// @param searchPattern Custo msearch pattern to use during that operation
|
// @param searchPattern Custom search pattern to use during that operation
|
||||||
// @param option Addidtional search options
|
// @param option Additional search options
|
||||||
// @returns True if an error occurred, otherwise false
|
// @returns True if an error occurred, otherwise false
|
||||||
static bool DirectoryGetFiles(Array<String, HeapAllocation>& results, const String& path, const Char* searchPattern, DirectorySearchOption option = DirectorySearchOption::AllDirectories);
|
static bool DirectoryGetFiles(Array<String, HeapAllocation>& results, const String& path, const Char* searchPattern, DirectorySearchOption option = DirectorySearchOption::AllDirectories);
|
||||||
|
|
||||||
// Finds the names of directories (including their paths) that are inside the specified directory
|
// Finds the names of directories (including their paths) that are inside the specified directory
|
||||||
// @param results When this metod completes, this list contains list of all filenames that match the specified search pattern
|
// @param results When this method completes, this list contains list of all filenames that match the specified search pattern
|
||||||
// @param directory Path of the directory to search in it
|
// @param directory Path of the directory to search in it
|
||||||
// @returns True if an error occurred, otherwise false
|
// @returns True if an error occurred, otherwise false
|
||||||
static bool GetChildDirectories(Array<String, HeapAllocation>& results, const String& directory);
|
static bool GetChildDirectories(Array<String, HeapAllocation>& results, const String& directory);
|
||||||
|
|||||||
Reference in New Issue
Block a user