File tree Expand file tree Collapse file tree 6 files changed +21
-11
lines changed
Expand file tree Collapse file tree 6 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -3297,8 +3297,11 @@ String String::path_to_file(const String& p_path) const {
32973297
32983298 String src=this ->replace (" \\ " ," /" ).get_base_dir ();
32993299 String dst=p_path.replace (" \\ " ," /" ).get_base_dir ();
3300-
3301- return src.path_to (dst)+p_path.get_file ();
3300+ String rel = src.path_to (dst);
3301+ if (rel==dst) // failed
3302+ return p_path;
3303+ else
3304+ return rel+p_path.get_file ();
33023305}
33033306
33043307String String::path_to (const String& p_path) const {
@@ -3333,7 +3336,9 @@ String String::path_to(const String& p_path) const {
33333336 String src_begin=src.get_slice (" /" ,0 );
33343337 String dst_begin=dst.get_slice (" /" ,0 );
33353338
3336- ERR_FAIL_COND_V (src_begin!=dst_begin,p_path); // return dst absolute path
3339+ if (src_begin!=dst_begin)
3340+ return p_path; // impossible to do this
3341+
33373342 base=src_begin;
33383343 src=src.substr (src_begin.length (),src.length ());
33393344 dst=dst.substr (dst_begin.length (),dst.length ());
Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
167167
168168 if (worked) {
169169
170+
170171 GetCurrentDirectoryW (2048 ,real_current_dir_name);
171172 current_dir=real_current_dir_name; // TODO, utf8 parser
172173 current_dir=current_dir.replace (" \\ " ," /" );
Original file line number Diff line number Diff line change @@ -2117,12 +2117,13 @@ bool OS_Windows::has_environment(const String& p_var) const {
21172117
21182118String OS_Windows::get_environment (const String& p_var) const {
21192119
2120- char * val = getenv (p_var.utf8 ().get_data ());
2121- if (val)
2122- return val;
2123-
2120+ wchar_t wval[0x7Fff ]; // MSDN says 32767 char is the maximum
2121+ int wlen = GetEnvironmentVariableW (p_var.c_str (),wval,0x7Fff );
2122+ if ( wlen > 0 ) {
2123+ return wval;
2124+ }
21242125 return " " ;
2125- };
2126+ }
21262127
21272128String OS_Windows::get_stdin_string (bool p_block) {
21282129
Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ void FileDialog::_file_entered(const String& p_file) {
9292}
9393
9494void FileDialog::_save_confirm_pressed () {
95-
9695 String f=dir_access->get_current_dir ().plus_file (file->get_text ());
9796 emit_signal (" file_selected" ,f);
9897 hide ();
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ String EditorImportPlugin::validate_source_path(const String& p_path) {
4747 String rp = Globals::get_singleton ()->get_resource_path ();
4848 if (!rp.ends_with (" /" ))
4949 rp+=" /" ;
50+
5051 return rp.path_to_file (gp);
5152}
5253
Original file line number Diff line number Diff line change @@ -406,7 +406,10 @@ class EditorFontImportDialog : public ConfirmationDialog {
406406 imd->set_option (opt,v);
407407 }
408408
409- imd->add_source (EditorImportPlugin::validate_source_path (source->get_line_edit ()->get_text ()));
409+ String src_path = EditorImportPlugin::validate_source_path (source->get_line_edit ()->get_text ());
410+ // print_line("pre src path "+source->get_line_edit()->get_text());
411+ // print_line("src path "+src_path);
412+ imd->add_source (src_path);
410413 imd->set_option (" font/size" ,font_size->get_val ());
411414
412415 return imd;
@@ -1018,7 +1021,7 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
10181021 int h = slot->bitmap .rows ;
10191022 int p = slot->bitmap .pitch ;
10201023
1021- print_line (" W: " +itos (w)+" P: " +itos (slot->bitmap .pitch ));
1024+ // print_line("W: "+itos(w)+" P: "+itos(slot->bitmap.pitch));
10221025
10231026 if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) {
10241027
You can’t perform that action at this time.
0 commit comments