diff options
author | est31 <MTest31@outlook.com> | 2015-11-30 02:35:59 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-11-30 02:35:59 +0100 |
commit | e1d02e4831fdec372771956aa2ac70954ab3fe7b (patch) | |
tree | a95d60ae6481cd96a53af896710e43429187353a | |
parent | 15f6d3cebf9e8c9288132454816f1152e16dde36 (diff) |
Make the setting unix-only.
For this, put the detection into the OS class and its subclass.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | SConstruct | 2 | ||||
-rw-r--r-- | core/os/os.h | 1 | ||||
-rw-r--r-- | drivers/unix/SCsub | 8 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 8 | ||||
-rw-r--r-- | drivers/unix/os_unix.h | 3 | ||||
-rw-r--r-- | tools/editor/SCsub | 9 | ||||
-rw-r--r-- | tools/editor/editor_import_export.cpp | 4 |
8 files changed, 24 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore index cfdb0af68a..d947306558 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 e44091d783..caf9ce1eea 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 e5338b4a02..e908177df7 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<String>& 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 9fbb467baa..e8b3cadfc7 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 fd8c26f6d9..94a7b03f45 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 2ee6102164..9ac18c9055 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 c96386fb18..cd46ff8353 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 5ecc6f6704..2bd4fb52c0 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -402,9 +402,9 @@ Vector<StringName> 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)) { |