1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Use .godot as file extension for project files.

Now project files don't have to be named "godot.cfg" anymore, they can have any name so as long as it ends with *.godot.
Also godot will automatically start the editor now if launched with a project file as an argument.
This allows for double-clicking of projects to open them :)

Code-wise this should be complete, but there's still work to do:

- Make a nice icon for godot projects.
- Work on installers/packaging -> register the extension and icon with godot.
- Update the 2.1 to 3.0 exporter.

Tested on linux and windows so far.
This commit is contained in:
Andreas Haas
2017-04-16 10:17:24 +02:00
parent e46af1e236
commit c06a2db63a
7 changed files with 148 additions and 45 deletions

View File

@@ -129,7 +129,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n");
OS::get_singleton()->print("Usage: %s [options] [scene]\n", p_binary);
OS::get_singleton()->print("Options:\n");
OS::get_singleton()->print("\t-path [dir] : Path to a game, containing godot.cfg\n");
OS::get_singleton()->print("\t-path [dir] : Path to a game, containing *.godot\n");
#ifdef TOOLS_ENABLED
OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n");
#endif
@@ -447,6 +447,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else {
goto error;
}
} else if (I->get().ends_with(".godot")) {
String path;
String file = I->get();
int sep = MAX(file.find_last("/"), file.find_last("\\"));
if (sep == -1)
path = ".";
else {
path = file.substr(0, sep);
}
if (OS::get_singleton()->set_cwd(path) == OK) {
} else {
game_path = path;
}
#ifdef TOOLS_ENABLED
editor = true;
#endif
} else if (I->get() == "-bp") { // /breakpoints
if (I->next()) {
@@ -673,7 +690,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
else
input_map->load_from_globals(); //keys for game
if (video_driver == "") // specified in godot.cfg
if (video_driver == "") // specified in *.godot
video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0)));
if (!force_res && use_custom_res && globals->has("display/window/width"))
@@ -725,7 +742,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
/* Determine Video Driver */
if (audio_driver == "") { // specified in godot.cfg
if (audio_driver == "") { // specified in *.godot
audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
}