working on template validation

This commit is contained in:
Juan Linietsky 2017-02-21 21:30:20 -03:00
parent d0973e645c
commit 2c88f4d4b5
2 changed files with 48 additions and 9 deletions

View File

@ -326,7 +326,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata,const String& p_path
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;
+"/templates/"+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"."+_MKSTR(VERSION_STATUS)+"/"+template_file_name;
String system_file=OS::get_singleton()->get_installed_templates_path();
bool has_system_path=(system_file!="");
system_file+=template_file_name;
@ -891,15 +891,27 @@ Ref<Texture> EditorExportPlatformPC::get_logo() const {
return logo;
}
bool EditorExportPlatformPC::can_export(String *r_error) const {
return true;
bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset>& p_preset,String &r_error, bool &r_missing_templates) const {
r_missing_templates=false;
if (find_export_template(release_file_32)==String()) {
r_missing_templates=true;
} else if (find_export_template(debug_file_32)==String()) {
r_missing_templates=true;
} else if (find_export_template(release_file_64)==String()) {
r_missing_templates=true;
} else if (find_export_template(debug_file_64)==String()) {
r_missing_templates=true;
}
return !r_missing_templates;
}
String EditorExportPlatformPC::get_binary_extension() const {
return extension;
}
Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset>& p_preset,const String& p_path,int p_flags) {
Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset>& p_preset, bool p_debug, const String& p_path, int p_flags) {
return OK;
}
@ -916,6 +928,25 @@ void EditorExportPlatformPC::set_logo(const Ref<Texture>& p_logo) {
logo=p_logo;
}
void EditorExportPlatformPC::set_release_64(const String& p_file) {
release_file_64=p_file;
}
void EditorExportPlatformPC::set_release_32(const String& p_file){
release_file_32=p_file;
}
void EditorExportPlatformPC::set_debug_64(const String& p_file){
debug_file_64=p_file;
}
void EditorExportPlatformPC::set_debug_32(const String& p_file){
debug_file_32=p_file;
}
EditorExportPlatformPC::EditorExportPlatformPC() {
}

View File

@ -203,10 +203,10 @@ public:
virtual Error run(int p_device,int p_debug_flags) { return OK; }
virtual bool can_export(String *r_error=NULL) const=0;
virtual bool can_export(const Ref<EditorExportPreset>& p_preset,String &r_error,bool &r_missing_templates) const=0;
virtual String get_binary_extension() const=0;
virtual Error export_project(const Ref<EditorExportPreset>& p_preset,const String& p_path,int p_flags=0)=0;
virtual Error export_project(const Ref<EditorExportPreset>& p_preset,bool p_debug,const String& p_path,int p_flags=0)=0;
EditorExportPlatform();
};
@ -262,7 +262,10 @@ class EditorExportPlatformPC : public EditorExportPlatform {
String name;
String extension;
String release_file_32;
String release_file_64;
String debug_file_32;
String debug_file_64;
public:
@ -273,15 +276,20 @@ public:
virtual String get_name() const;
virtual Ref<Texture> get_logo() const;
virtual bool can_export(String *r_error=NULL) const;
virtual bool can_export(const Ref<EditorExportPreset>& p_preset,String &r_error,bool &r_missing_templates) const;
virtual String get_binary_extension() const;
virtual Error export_project(const Ref<EditorExportPreset>& p_preset,const String& p_path,int p_flags=0);
virtual Error export_project(const Ref<EditorExportPreset>& p_preset,bool p_debug,const String& p_path,int p_flags=0);
void set_extension(const String& p_extension);
void set_name(const String& p_name);
void set_logo(const Ref<Texture>& p_loco);
void set_release_64(const String& p_file);
void set_release_32(const String& p_file);
void set_debug_64(const String& p_file);
void set_debug_32(const String& p_file);
EditorExportPlatformPC();
};