diff --git a/res/project.toml b/res/project/project.toml similarity index 100% rename from res/project.toml rename to res/project/project.toml diff --git a/res/project_client.lua b/res/project/project_client.lua similarity index 100% rename from res/project_client.lua rename to res/project/project_client.lua diff --git a/src/constants.hpp b/src/constants.hpp index 03900b9e3..a64a05e38 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -86,3 +86,4 @@ inline const std::string SOUNDS_FOLDER = "sounds"; inline const std::string TEXTURES_FOLDER = "textures"; inline const std::string FONT_DEFAULT = "normal"; +inline const std::string DEFAULT_PROJECT_PATH = "project"; diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index b3185f371..1a4361f9e 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -132,7 +132,17 @@ void Engine::initialize(CoreParameters coreParameters) { logger.info() << "engine runs in headless mode"; } if (params.projectFolder.empty()) { - params.projectFolder = params.resFolder; + auto userDefProjectPath = + params.userFolder / std::filesystem::u8path(DEFAULT_PROJECT_PATH); + auto resDefProjectPath = + params.resFolder / std::filesystem::u8path(DEFAULT_PROJECT_PATH); + if (std::filesystem::is_directory(userDefProjectPath)) { + params.projectFolder = userDefProjectPath; + } else if (std::filesystem::is_directory(resDefProjectPath)) { + params.projectFolder = resDefProjectPath; + } else { + params.projectFolder = params.resFolder; + } } paths = std::make_unique(params); loadProject();