فهرست منبع

Make the setting unix-only.

For this, put the detection into the OS class and its subclass.
est31 9 سال پیش
والد
کامیت
e1d02e4831
8فایلهای تغییر یافته به همراه24 افزوده شده و 13 حذف شده
  1. 1 1
      .gitignore
  2. 1 1
      SConstruct
  3. 1 0
      core/os/os.h
  4. 8 0
      drivers/unix/SCsub
  5. 8 0
      drivers/unix/os_unix.cpp
  6. 3 0
      drivers/unix/os_unix.h
  7. 0 9
      tools/editor/SCsub
  8. 2 2
      tools/editor/editor_import_export.cpp

+ 1 - 1
.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

+ 1 - 1
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')

+ 1 - 0
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;

+ 8 - 0
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')

+ 8 - 0
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__

+ 3 - 0
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;
 

+ 0 - 9
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)
 

+ 2 - 2
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)) {