Merge pull request #1035 from MihailRis/default-project
Some checks are pending
x86-64 AppImage / build-appimage (ubuntu-22.04) (push) Waiting to run
Build / Build (push) Waiting to run
Macos Build / build-dmg (push) Waiting to run
Windows Build (CLang) / build-windows (clang, windows-latest) (push) Waiting to run
MSVC Build / build-windows (windows-2022) (push) Waiting to run

feat: 'res:project' as default project
This commit is contained in:
MihailRis 2026-10-12 22:38:42 +03:00 • committed by GitHub
commit d03d5d2859
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 1 deletions

View file

@ -86,3 +86,4 @@ inline const std::string SOUNDS_FOLDER = "sounds";
inline const std::string TEXTURES_FOLDER = "textures"; inline const std::string TEXTURES_FOLDER = "textures";
inline const std::string FONT_DEFAULT = "normal"; inline const std::string FONT_DEFAULT = "normal";
inline const std::string DEFAULT_PROJECT_PATH = "project";

View file

@ -132,7 +132,17 @@ void Engine::initialize(CoreParameters coreParameters) {
logger.info() << "engine runs in headless mode"; logger.info() << "engine runs in headless mode";
} }
if (params.projectFolder.empty()) { 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<EnginePaths>(params); paths = std::make_unique<EnginePaths>(params);
loadProject(); loadProject();