diff --git a/.gitignore b/.gitignore index cfdb0af68a6..d9473065585 100644 --- a/.gitignore +++ b/.gitignore @@ -15,10 +15,10 @@ core/method_bind.inc core/method_bind_ext.inc core/script_encryption_key.cpp core/global_defaults.cpp +drivers/unix/os_unix_global_settings_path.cpp tools/editor/register_exporters.cpp tools/editor/doc_data_compressed.h tools/editor/editor_icons.cpp -tools/editor/editor_global_settings.cpp -fpic .fscache make.bat diff --git a/SConstruct b/SConstruct index e44091d7833..caf9ce1eea9 100644 --- a/SConstruct +++ b/SConstruct @@ -126,7 +126,7 @@ opts.Add("CXX", "Compiler"); opts.Add("CCFLAGS", "Custom flags for the C++ compiler"); opts.Add("CFLAGS", "Custom flags for the C compiler"); opts.Add("LINKFLAGS", "Custom flags for the linker"); -opts.Add('global_settings_path', 'Path to system-wide settings. Currently only used by templates.','') +opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','') opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no') diff --git a/core/os/os.h b/core/os/os.h index e5338b4a02f..e908177df76 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -184,6 +184,7 @@ public: virtual void set_low_processor_usage_mode(bool p_enabled); virtual bool is_in_low_processor_usage_mode() const; + virtual String get_installed_templates_path() const { return ""; }; virtual String get_executable_path() const; virtual Error execute(const String& p_path, const List& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL)=0; virtual Error kill(const ProcessID& p_pid)=0; diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub index 9fbb467baa1..e8b3cadfc77 100644 --- a/drivers/unix/SCsub +++ b/drivers/unix/SCsub @@ -1,5 +1,13 @@ Import('env') +ed_gl_set='#include "os_unix.h"\n' +ed_gl_set+='String OS_Unix::get_global_settings_path() const {\n' +ed_gl_set+='\treturn "' + env["unix_global_settings_path"]+'";\n' +ed_gl_set+='}\n' +f = open("os_unix_global_settings_path.cpp","wb") +f.write(ed_gl_set) +f.close() + env.add_source_files(env.drivers_sources,"*.cpp") Export('env') diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index fd8c26f6d9a..94a7b03f451 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -477,6 +477,14 @@ String OS_Unix::get_data_dir() const { } +String OS_Unix::get_installed_templates_path() const { + String p=get_global_settings_path(); + if (p!="") + return p+"/templates/"; + else + return ""; +} + String OS_Unix::get_executable_path() const { #ifdef __linux__ diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 2ee6102164d..9ac18c90557 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -64,6 +64,8 @@ protected: String stdin_buf; + String get_global_settings_path() const; + public: @@ -111,6 +113,7 @@ public: virtual void debug_break(); + virtual String get_installed_templates_path() const; virtual String get_executable_path() const; virtual String get_data_dir() const; diff --git a/tools/editor/SCsub b/tools/editor/SCsub index c96386fb18d..cd46ff83533 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -44,15 +44,6 @@ if (env["tools"]=="yes"): f.write(reg_exporters) f.close() - ed_gl_set='#include "editor_settings.h"\n' - ed_gl_set+='String EditorSettings::get_global_settings_path() const {\n' - ed_gl_set+='\treturn "' + env["global_settings_path"]+'";\n' - ed_gl_set+='}\n' - reg_exporters+='}\n' - f = open("editor_global_settings.cpp","wb") - f.write(ed_gl_set) - f.close() - env.Depends("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml") env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header) diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 5ecc6f67042..2bd4fb52c05 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -402,9 +402,9 @@ Vector EditorExportPlatform::get_dependencies(bool p_bundles) const String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { String user_file = EditorSettings::get_singleton()->get_settings_path() +"/templates/"+template_file_name; - String system_file=EditorSettings::get_singleton()->get_global_settings_path(); + String system_file=OS::get_singleton()->get_installed_templates_path(); bool has_system_path=(system_file!=""); - system_file+="/templates/"+template_file_name; + system_file+=template_file_name; // Prefer user file if (FileAccess::exists(user_file)) {