Make the setting unix-only.

For this, put the detection into the OS class and its subclass.
This commit is contained in:
est31 2015-11-30 02:35:59 +01:00
parent 15f6d3cebf
commit e1d02e4831
8 changed files with 24 additions and 13 deletions

2
.gitignore vendored
View File

@ -15,10 +15,10 @@ core/method_bind.inc
core/method_bind_ext.inc core/method_bind_ext.inc
core/script_encryption_key.cpp core/script_encryption_key.cpp
core/global_defaults.cpp core/global_defaults.cpp
drivers/unix/os_unix_global_settings_path.cpp
tools/editor/register_exporters.cpp tools/editor/register_exporters.cpp
tools/editor/doc_data_compressed.h tools/editor/doc_data_compressed.h
tools/editor/editor_icons.cpp tools/editor/editor_icons.cpp
tools/editor/editor_global_settings.cpp
-fpic -fpic
.fscache .fscache
make.bat make.bat

View File

@ -126,7 +126,7 @@ opts.Add("CXX", "Compiler");
opts.Add("CCFLAGS", "Custom flags for the C++ compiler"); opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
opts.Add("CFLAGS", "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("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_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('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') opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')

View File

@ -184,6 +184,7 @@ public:
virtual void set_low_processor_usage_mode(bool p_enabled); virtual void set_low_processor_usage_mode(bool p_enabled);
virtual bool is_in_low_processor_usage_mode() const; virtual bool is_in_low_processor_usage_mode() const;
virtual String get_installed_templates_path() const { return ""; };
virtual String get_executable_path() const; 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 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; virtual Error kill(const ProcessID& p_pid)=0;

View File

@ -1,5 +1,13 @@
Import('env') 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") env.add_source_files(env.drivers_sources,"*.cpp")
Export('env') Export('env')

View File

@ -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 { String OS_Unix::get_executable_path() const {
#ifdef __linux__ #ifdef __linux__

View File

@ -64,6 +64,8 @@ protected:
String stdin_buf; String stdin_buf;
String get_global_settings_path() const;
public: public:
@ -111,6 +113,7 @@ public:
virtual void debug_break(); virtual void debug_break();
virtual String get_installed_templates_path() const;
virtual String get_executable_path() const; virtual String get_executable_path() const;
virtual String get_data_dir() const; virtual String get_data_dir() const;

View File

@ -44,15 +44,6 @@ if (env["tools"]=="yes"):
f.write(reg_exporters) f.write(reg_exporters)
f.close() 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.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) env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header)

View File

@ -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 EditorExportPlatform::find_export_template(String template_file_name, String *err) const {
String user_file = EditorSettings::get_singleton()->get_settings_path() String user_file = EditorSettings::get_singleton()->get_settings_path()
+"/templates/"+template_file_name; +"/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!=""); bool has_system_path=(system_file!="");
system_file+="/templates/"+template_file_name; system_file+=template_file_name;
// Prefer user file // Prefer user file
if (FileAccess::exists(user_file)) { if (FileAccess::exists(user_file)) {