mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Merge pull request #24086 from RandomShaper/bundle-pck-to-executable
Enhance game export
This commit is contained in:
@@ -343,17 +343,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
return err;
|
||||
}
|
||||
|
||||
// Attempt with exec_name.pck
|
||||
// (This is the usual case when distributing a Godot game.)
|
||||
|
||||
// Based on the OS, it can be the exec path + '.pck' (Linux w/o extension, macOS in .app bundle)
|
||||
// or the exec path's basename + '.pck' (Windows).
|
||||
// We need to test both possibilities as extensions for Linux binaries are optional
|
||||
// (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck').
|
||||
|
||||
String exec_path = OS::get_singleton()->get_executable_path();
|
||||
|
||||
if (exec_path != "") {
|
||||
// Attempt with exec_name.pck
|
||||
// (This is the usual case when distributing a Godot game.)
|
||||
|
||||
// Based on the OS, it can be the exec path + '.pck' (Linux w/o extension, macOS in .app bundle)
|
||||
// or the exec path's basename + '.pck' (Windows).
|
||||
// We need to test both possibilities as extensions for Linux binaries are optional
|
||||
// (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck').
|
||||
|
||||
bool found = false;
|
||||
|
||||
String exec_dir = exec_path.get_base_dir();
|
||||
@@ -375,6 +375,14 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt with PCK bundled into executable
|
||||
|
||||
if (!found) {
|
||||
if (_load_resource_pack(exec_path)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we opened our package, try and load our project
|
||||
if (found) {
|
||||
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
|
||||
|
||||
Reference in New Issue
Block a user