summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ustring.cpp11
-rw-r--r--scene/gui/file_dialog.cpp1
-rw-r--r--tools/editor/editor_import_export.cpp1
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.cpp7
4 files changed, 14 insertions, 6 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index ffd22c1f8f..5df95ac4c2 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3297,8 +3297,11 @@ String String::path_to_file(const String& p_path) const {
String src=this->replace("\\","/").get_base_dir();
String dst=p_path.replace("\\","/").get_base_dir();
-
- return src.path_to(dst)+p_path.get_file();
+ String rel = src.path_to(dst);
+ if (rel==dst) // failed
+ return p_path;
+ else
+ return rel+p_path.get_file();
}
String String::path_to(const String& p_path) const {
@@ -3333,7 +3336,9 @@ String String::path_to(const String& p_path) const {
String src_begin=src.get_slice("/",0);
String dst_begin=dst.get_slice("/",0);
- ERR_FAIL_COND_V(src_begin!=dst_begin,p_path); //return dst absolute path
+ if (src_begin!=dst_begin)
+ return p_path; //impossible to do this
+
base=src_begin;
src=src.substr(src_begin.length(),src.length());
dst=dst.substr(dst_begin.length(),dst.length());
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 50ce657d2e..13cf87ac2b 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -92,7 +92,6 @@ void FileDialog::_file_entered(const String& p_file) {
}
void FileDialog::_save_confirm_pressed() {
-
String f=dir_access->get_current_dir().plus_file(file->get_text());
emit_signal("file_selected",f);
hide();
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index d76009a72a..4e6435b22e 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -47,6 +47,7 @@ String EditorImportPlugin::validate_source_path(const String& p_path) {
String rp = Globals::get_singleton()->get_resource_path();
if (!rp.ends_with("/"))
rp+="/";
+
return rp.path_to_file(gp);
}
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp
index b0ff6f6e74..375333ddf6 100644
--- a/tools/editor/io_plugins/editor_font_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp
@@ -406,7 +406,10 @@ class EditorFontImportDialog : public ConfirmationDialog {
imd->set_option(opt,v);
}
- imd->add_source(EditorImportPlugin::validate_source_path(source->get_line_edit()->get_text()));
+ String src_path = EditorImportPlugin::validate_source_path(source->get_line_edit()->get_text());
+ //print_line("pre src path "+source->get_line_edit()->get_text());
+ //print_line("src path "+src_path);
+ imd->add_source(src_path);
imd->set_option("font/size",font_size->get_val());
return imd;
@@ -1018,7 +1021,7 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
int h = slot->bitmap.rows;
int p = slot->bitmap.pitch;
- print_line("W: "+itos(w)+" P: "+itos(slot->bitmap.pitch));
+ //print_line("W: "+itos(w)+" P: "+itos(slot->bitmap.pitch));
if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) {