diff --git a/core/globals.cpp b/core/globals.cpp index 28fabac302f..b89303b728e 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -329,7 +329,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { String candidate = d->get_current_dir(); String current_dir = d->get_current_dir(); - String exec_name = OS::get_singleton()->get_executable_path().get_file().basename(); + String exec_name = OS::get_singleton()->get_executable_path().get_file().get_basename(); bool found = false; bool first_time=true; diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index c4439f2599f..87f07cb7b1d 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -165,7 +165,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { bool ZipArchive::try_open_pack(const String& p_name) { //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); - if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0) + if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0) return false; zlib_filefunc_def io; diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index d4d10e21260..2b01e865f45 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -36,7 +36,7 @@ bool ImageFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -56,7 +56,7 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom } } - String extension = p_file.extension(); + String extension = p_file.get_extension(); for (int i=0;i::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -182,7 +182,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p if (OS::get_singleton()->is_stdout_verbose()) print_line("load resource: "+remapped_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i ResourceLoader::load_import_metadata(const String &p else local_path = GlobalConfig::get_singleton()->localize_path(p_path); - String extension=p_path.extension(); + String extension=p_path.get_extension(); Ref ret; for (int i=0;i ResourceLoader::load_interactive(const String &p_ String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i *p_depe String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;iget_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;ilocalize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(extension.extension())==0) + if (E->get().nocasecmp_to(extension.get_extension())==0) recognized=true; } diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 8c4c1c8180d..bee38e037f3 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -204,7 +204,7 @@ bool TranslationLoaderPO::handles_type(const String& p_type) const{ String TranslationLoaderPO::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="po") + if (p_path.get_extension().to_lower()=="po") return "Translation"; return ""; } diff --git a/core/ustring.cpp b/core/ustring.cpp index 27bb8eac725..cce355afd5f 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3812,7 +3812,7 @@ String String::get_file() const { return substr(sep+1,length()); } -String String::extension() const { +String String::get_extension() const { int pos = find_last("."); if (pos<0) @@ -3891,7 +3891,7 @@ String String::percent_decode() const { return String::utf8(pe.ptr()); } -String String::basename() const { +String String::get_basename() const { int pos = find_last("."); if (pos<0) diff --git a/core/ustring.h b/core/ustring.h index 9a145143d08..674551ec805 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -176,8 +176,8 @@ public: String right(int p_pos) const; String strip_edges(bool left = true, bool right = true) const; String strip_escapes() const; - String extension() const; - String basename() const; + String get_extension() const; + String get_basename() const; String plus_file(const String& p_file) const; CharType ord_at(int p_idx) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index b20f8aafd1a..f51abe72894 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -272,8 +272,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,left); VCALL_LOCALMEM1R(String,right); VCALL_LOCALMEM2R(String,strip_edges); - VCALL_LOCALMEM0R(String,extension); - VCALL_LOCALMEM0R(String,basename); + VCALL_LOCALMEM0R(String,get_extension); + VCALL_LOCALMEM0R(String,get_basename); VCALL_LOCALMEM1R(String,plus_file); VCALL_LOCALMEM1R(String,ord_at); VCALL_LOCALMEM2(String,erase); @@ -1405,8 +1405,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray()); ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray()); ADDFUNC2(STRING,STRING,String,strip_edges,BOOL,"left",BOOL,"right",varray(true,true)); - ADDFUNC0(STRING,STRING,String,extension,varray()); - ADDFUNC0(STRING,STRING,String,basename,varray()); + ADDFUNC0(STRING,STRING,String,get_extension,varray()); + ADDFUNC0(STRING,STRING,String,get_basename,varray()); ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray()); ADDFUNC1(STRING,INT,String,ord_at,INT,"at",varray()); ADDFUNC2(STRING,NIL,String,erase,INT,"pos",INT,"chars", varray()); diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 1ee27ec661b..4f4e76d517f 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -1026,7 +1026,7 @@ MainLoop* test(TestType p_test) { } else if (p_test==TEST_BYTECODE) { Vector buf = GDTokenizerBuffer::parse_code_string(code); - String dst = test.basename()+".gdc"; + String dst = test.get_basename()+".gdc"; FileAccess *fw = FileAccess::open(dst,FileAccess::WRITE); fw->store_buffer(buf.ptr(),buf.size()); memdelete(fw); diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp index 73d1c01e33a..8bccdb31025 100644 --- a/modules/chibi/event_stream_chibi.cpp +++ b/modules/chibi/event_stream_chibi.cpp @@ -785,7 +785,7 @@ RES ResourceFormatLoaderChibi::load(const String &p_path, const String& p_origin if (r_error) *r_error=ERR_FILE_CANT_OPEN; - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); CPFileAccessWrapperImpl f; @@ -849,7 +849,7 @@ bool ResourceFormatLoaderChibi::handles_type(const String& p_type) const { } String ResourceFormatLoaderChibi::get_resource_type(const String &p_path) const { - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); if (el=="it" || el=="s3m" || el=="xm" || el=="mod") return "EventStreamChibi"; return ""; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 1de98a6b1f4..82deae9630b 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -478,7 +478,7 @@ bool ResourceFormatDDS::handles_type(const String& p_type) const { String ResourceFormatDDS::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="dds") + if (p_path.get_extension().to_lower()=="dds") return "ImageTexture"; return ""; } diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp index 42c9937b8f7..e720e1fb4c1 100644 --- a/modules/etc1/texture_loader_pkm.cpp +++ b/modules/etc1/texture_loader_pkm.cpp @@ -78,7 +78,7 @@ bool ResourceFormatPKM::handles_type(const String& p_type) const { String ResourceFormatPKM::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="pkm") + if (p_path.get_extension().to_lower()=="pkm") return "ImageTexture"; return ""; } diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 00b080190f7..ab917fc869f 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -671,7 +671,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser:: if (!script.ends_with(".gd")) { //not a script, try find the script anyway, //may have some success - script=script.basename()+".gd"; + script=script.get_basename()+".gd"; } if (FileAccess::exists(script)) { @@ -1168,7 +1168,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const if (!script.ends_with(".gd")) { //not a script, try find the script anyway, //may have some success - script=script.basename()+".gd"; + script=script.get_basename()+".gd"; } if (FileAccess::exists(script)) { @@ -2832,7 +2832,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol if (!script.ends_with(".gd")) { //not a script, try find the script anyway, //may have some success - script=script.basename()+".gd"; + script=script.get_basename()+".gd"; } if (FileAccess::exists(script)) { diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index ad012e54b1b..6ff29072c7c 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -2068,7 +2068,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const { String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const { - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); if (el=="gd" || el=="gdc" || el=="gde") return "GDScript"; return ""; diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 11bdf783f8b..051d1d85cdf 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -100,7 +100,7 @@ public: if (err==OK) { fae->store_buffer(file.ptr(),file.size()); - p_path=p_path.basename()+".gde"; + p_path=p_path.get_basename()+".gde"; } memdelete(fae); @@ -111,7 +111,7 @@ public: } else { - p_path=p_path.basename()+".gdc"; + p_path=p_path.get_basename()+".gdc"; return file; } } diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp index f438dde6899..4a6b2e224cd 100644 --- a/modules/opus/audio_stream_opus.cpp +++ b/modules/opus/audio_stream_opus.cpp @@ -366,7 +366,7 @@ void ResourceFormatLoaderAudioStreamOpus::get_recognized_extensions(List } String ResourceFormatLoaderAudioStreamOpus::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="opus") + if (p_path.get_extension().to_lower()=="opus") return "AudioStreamOpus"; return ""; } diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp index 6caaf103341..ab0805a6b01 100644 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ b/modules/pbm/bitmap_loader_pbm.cpp @@ -244,7 +244,7 @@ bool ResourceFormatPBM::handles_type(const String& p_type) const { } String ResourceFormatPBM::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="pbm") + if (p_path.get_extension().to_lower()=="pbm") return "BitMap"; return ""; } diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 9f8db98e05e..564cd6687cc 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -185,7 +185,7 @@ bool ResourceFormatPVR::handles_type(const String& p_type) const { String ResourceFormatPVR::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="pvr") + if (p_path.get_extension().to_lower()=="pvr") return "Texture"; return ""; } diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index b847f17bb76..5fe11c8d4cb 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -933,7 +933,7 @@ bool ResourceFormatLoaderVideoStreamTheora::handles_type(const String& p_type) c String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_path) const { - String exl=p_path.extension().to_lower(); + String exl=p_path.get_extension().to_lower(); if (exl=="ogm" || exl=="ogv") return "VideoStreamTheora"; return ""; diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 7abcd0a8b75..4a18e88060f 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -419,7 +419,7 @@ void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List *p_extens String ResourceFormatLoaderImage::get_resource_type(const String &p_path) const { - String ext=p_path.extension().to_lower(); + String ext=p_path.get_extension().to_lower(); if (ext=="cube") return "CubeMap"; diff --git a/scene/io/resource_format_wav.cpp b/scene/io/resource_format_wav.cpp index f75836d2dfb..0a19e6f72b1 100644 --- a/scene/io/resource_format_wav.cpp +++ b/scene/io/resource_format_wav.cpp @@ -267,7 +267,7 @@ bool ResourceFormatLoaderWAV::handles_type(const String& p_type) const { String ResourceFormatLoaderWAV::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="wav") + if (p_path.get_extension().to_lower()=="wav") return "Sample"; return ""; } diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 3aadbdbe19e..bb1552e2d6a 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -961,7 +961,7 @@ bool ResourceFormatLoaderDynamicFont::handles_type(const String& p_type) const { String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path) const { - String el = p_path.extension().to_lower(); + String el = p_path.get_extension().to_lower(); if (el=="ttf" || el=="otf") return "DynamicFontData"; return ""; diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index fa56f634658..448e18ce39e 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -984,7 +984,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{ - String ext=p_path.extension().to_lower(); + String ext=p_path.get_extension().to_lower(); if (ext=="tscn") return "PackedScene"; else if (ext!="tres") diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 2e3afbf0576..0ddc907aa00 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -1147,7 +1147,7 @@ bool ResourceFormatLoaderTheme::handles_type(const String& p_type) const { String ResourceFormatLoaderTheme::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="theme") + if (p_path.get_extension().to_lower()=="theme") return "Theme"; return ""; } diff --git a/tools/editor/editor_asset_installer.cpp b/tools/editor/editor_asset_installer.cpp index 54099ddce5f..9992100ff80 100644 --- a/tools/editor/editor_asset_installer.cpp +++ b/tools/editor/editor_asset_installer.cpp @@ -196,7 +196,7 @@ void EditorAssetInstaller::open(const String& p_path,int p_depth) { ti->set_icon(0,get_icon("folder","FileDialog")); } else { String file = path.get_file(); - String extension = file.extension().to_lower(); + String extension = file.get_extension().to_lower(); if (extension_guess.has(extension)) { ti->set_icon(0,extension_guess[extension]); } else { diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 071a237ea89..087bf1a3b73 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -307,7 +307,7 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu void EditorAutoloadSettings::_autoload_file_callback(const String& p_path) { - autoload_add_name->set_text(p_path.get_file().basename()); + autoload_add_name->set_text(p_path.get_file().get_basename()); } void EditorAutoloadSettings::update_autoload() { diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 5fb274f38f7..03c7b7f74cf 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -670,7 +670,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess for (List::Element*E=files.front();E;E=E->next(),idx++) { - String ext = E->get().extension().to_lower(); + String ext = E->get().get_extension().to_lower(); if (!valid_extensions.has(ext)) continue; //invalid @@ -789,7 +789,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } else { - String ext = f.extension().to_lower(); + String ext = f.get_extension().to_lower(); if (!valid_extensions.has(ext)) continue; //invalid diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 0003e232c84..cc64ffb1034 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -949,7 +949,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func return ERR_CANT_CREATE; } Vector data = FileAccess::get_file_as_array(path); - String dst_path = F->get().operator String().basename()+".atex"; + String dst_path = F->get().operator String().get_basename()+".atex"; err = p_func(p_udata,dst_path,data,counter++,files.size()); saved.insert(dst_path); if (err) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index b4a2da4833f..57f9c46381b 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -623,7 +623,7 @@ void EditorNode::save_resource_as(const Ref& p_resource,const String& file->set_current_path(p_resource->get_path()); if (extensions.size()) { - String ext=p_resource->get_path().extension().to_lower(); + String ext=p_resource->get_path().get_extension().to_lower(); if (extensions.find(ext)==NULL) { file->set_current_path(p_resource->get_path().replacen("."+ext,"."+extensions.front()->get())); } @@ -666,11 +666,11 @@ void EditorNode::_dialog_display_file_error(String p_file,Error p_error) { case ERR_FILE_CANT_WRITE: { - accept->set_text(TTR("Can't open file for writing:")+" "+p_file.extension()); + accept->set_text(TTR("Can't open file for writing:")+" "+p_file.get_extension()); } break; case ERR_FILE_UNRECOGNIZED: { - accept->set_text(TTR("Requested file format unknown:")+" "+p_file.extension()); + accept->set_text(TTR("Requested file format unknown:")+" "+p_file.get_extension()); } break; default: { @@ -2154,7 +2154,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (scene->get_filename()!="") { file->set_current_path(scene->get_filename()); if (extensions.size()) { - String ext=scene->get_filename().extension().to_lower(); + String ext=scene->get_filename().get_extension().to_lower(); if (extensions.find(ext)==NULL) { file->set_current_path(scene->get_filename().replacen("."+ext,"."+extensions.front()->get())); } @@ -2217,8 +2217,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (scene->get_filename()!="") { cpath = scene->get_filename(); - String fn = cpath.substr(0,cpath.length() - cpath.extension().size()); - String ext=cpath.extension(); + String fn = cpath.substr(0,cpath.length() - cpath.get_extension().size()); + String ext=cpath.get_extension(); cpath=fn+".pot"; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 50bd629b672..2d6618f4496 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -846,8 +846,8 @@ void EditorSettings::list_text_editor_themes() { d->list_dir_begin(); String file = d->get_next(); while(file != String()) { - if (file.extension() == "tet" && file.basename().to_lower() != "default") { - themes += "," + file.basename(); + if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default") { + themes += "," + file.get_basename(); } file = d->get_next(); } diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index 8a21b94eea5..cd13d93cf57 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -1015,7 +1015,7 @@ void FileSystemDock::_file_option(int p_option) { if (move_dirs.empty() && move_files.size()==1) { rename_dialog->clear_filters(); - rename_dialog->add_filter("*."+move_files[0].extension()); + rename_dialog->add_filter("*."+move_files[0].get_extension()); rename_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); rename_dialog->set_current_path(move_files[0]); rename_dialog->popup_centered_ratio(); diff --git a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp index b4e0c4b82a5..bad6261d4e5 100644 --- a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp @@ -145,7 +145,7 @@ public: error_dialog->popup_centered(Size2(200, 100)*EDSCALE); } - dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm"); + dst = dst.plus_file(bitmasks[i].get_file().get_basename() + ".pbm"); plugin->import(dst, imd); } @@ -294,7 +294,7 @@ void EditorBitMaskImportPlugin::import_from_drop(const Vector& p_drop, c ImageLoader::get_recognized_extensions(&valid_extensions); for(int i=0;i::Element *E=valid_extensions.front();E;E=E->next()) { diff --git a/tools/editor/io_plugins/editor_export_scene.cpp b/tools/editor/io_plugins/editor_export_scene.cpp index c2e037cfd7b..ea67128f3cd 100644 --- a/tools/editor/io_plugins/editor_export_scene.cpp +++ b/tools/editor/io_plugins/editor_export_scene.cpp @@ -42,7 +42,7 @@ Vector EditorSceneExportPlugin::custom_export(String& p_path,const Ref< } - String extension = p_path.extension(); + String extension = p_path.get_extension(); //step 1 check if scene diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index bf9c9835f61..3f4e454cacc 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -468,7 +468,7 @@ class EditorFontImportDialog : public ConfirmationDialog { Ref tex = font->get_texture(0); if (tex.is_null()) return; - FileAccessRef f=FileAccess::open(p_font.basename()+".inc",FileAccess::WRITE); + FileAccessRef f=FileAccess::open(p_font.get_basename()+".inc",FileAccess::WRITE); Vector ck = font->get_char_keys(); f->store_line("static const int _builtin_font_height="+itos(font->get_height())+";"); @@ -499,7 +499,7 @@ class EditorFontImportDialog : public ConfirmationDialog { f->store_line("static const int _builtin_font_img_width="+itos(img.get_width())+";"); f->store_line("static const int _builtin_font_img_height="+itos(img.get_height())+";"); - String fname = p_font.basename()+".sv.png"; + String fname = p_font.get_basename()+".sv.png"; ResourceSaver::save(fname,tex); Vector data=FileAccess::get_file_as_array(fname); @@ -533,14 +533,14 @@ class EditorFontImportDialog : public ConfirmationDialog { } if (dest->get_line_edit()->get_text().get_file()==".fnt") { - dest->get_line_edit()->set_text(dest->get_line_edit()->get_text().get_base_dir() + "/" + source->get_line_edit()->get_text().get_file().basename() + ".fnt" ); + dest->get_line_edit()->set_text(dest->get_line_edit()->get_text().get_base_dir() + "/" + source->get_line_edit()->get_text().get_file().get_basename() + ".fnt" ); } - if (dest->get_line_edit()->get_text().extension() == dest->get_line_edit()->get_text()) { + if (dest->get_line_edit()->get_text().get_extension() == dest->get_line_edit()->get_text()) { dest->get_line_edit()->set_text(dest->get_line_edit()->get_text() + ".fnt"); } - if (dest->get_line_edit()->get_text().extension().to_lower() != "fnt") { + if (dest->get_line_edit()->get_text().get_extension().to_lower() != "fnt") { error_dialog->set_text(TTR("Invalid file extension.\nPlease use .fnt.")); error_dialog->popup_centered(Size2(200,100)); return; @@ -913,7 +913,7 @@ Ref EditorFontImportPlugin::generate_font(const Refget_source_path(0)); - if (src_path.extension().to_lower()=="fnt") { + if (src_path.get_extension().to_lower()=="fnt") { if (ResourceLoader::load(src_path).is_valid()) { EditorNode::get_singleton()->show_warning(TTR("Path:")+" "+src_path+"\n"+TTR("This file is already a Godot font file, please supply a BMFont type file instead.")); @@ -1682,12 +1682,12 @@ Error EditorFontImportPlugin::import(const String& p_path, const Ref& p_drop, const String &p_dest_path) { for(int i=0;iset_source_and_dest(p_drop[i],p_dest_path.plus_file(file.basename()+".fnt")); + dialog->set_source_and_dest(p_drop[i],p_dest_path.plus_file(file.get_basename()+".fnt")); break; } } diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 846a551121b..d17ca1d7f1a 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -2438,7 +2438,7 @@ Ref EditorSceneImporterCollada::import_animation(const String& p_path Ref anim=state.animations[0]; anim=state.animations[0]; print_line("Anim Load OK"); - String base = p_path.basename().to_lower(); + String base = p_path.get_basename().to_lower(); if (p_flags&IMPORT_ANIMATION_DETECT_LOOP) { if (base.begins_with("loop") || base.ends_with("loop") || base.begins_with("cycle") || base.ends_with("cycle")) { diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index f33693c304e..fa0c36be985 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -259,7 +259,7 @@ public: imd->add_source(EditorImportPlugin::validate_source_path(meshes[i])); - String file_path = dst.plus_file(meshes[i].get_file().basename()+".msh"); + String file_path = dst.plus_file(meshes[i].get_file().get_basename()+".msh"); plugin->import(file_path,imd); } @@ -568,7 +568,7 @@ void EditorMeshImportPlugin::import_from_drop(const Vector& p_drop, cons Vector files; for(int i=0;ipopup_centered(Size2(200,100)*EDSCALE); } - dst = dst.plus_file(samples[i].get_file().basename()+".smp"); + dst = dst.plus_file(samples[i].get_file().get_basename()+".smp"); plugin->import(dst,imd); } @@ -828,7 +828,7 @@ void EditorSampleImportPlugin::import_from_drop(const Vector& p_drop, co Vector files; for(int i=0;i EditorSampleExportPlugin::custom_export(String& p_path,const Ref - if (EditorImportExport::get_singleton()->sample_get_action()==EditorImportExport::SAMPLE_ACTION_NONE || p_path.extension().to_lower()!="wav") { + if (EditorImportExport::get_singleton()->sample_get_action()==EditorImportExport::SAMPLE_ACTION_NONE || p_path.get_extension().to_lower()!="wav") { return Vector(); } @@ -911,7 +911,7 @@ Vector EditorSampleExportPlugin::custom_export(String& p_path,const Ref ERR_FAIL_COND_V(err!=OK,Vector()); - p_path=p_path.basename()+".converted.smp"; + p_path=p_path.get_basename()+".converted.smp"; return FileAccess::get_file_as_array(savepath); } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 8fd78f11f39..ae0559636bd 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -659,7 +659,7 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) { import_path->set_text(p_path); if (root_node_name->get_text().size()==0){ - root_node_name->set_text(import_path->get_text().get_file().basename()); + root_node_name->set_text(import_path->get_text().get_file().get_basename()); } } @@ -763,7 +763,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) { // Scenes should always be imported as binary format since vertex data is large and would take // up a lot of space and time to load if imported as text format (GH-5778) - String save_file = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+".scn"); + String save_file = save_path->get_text().plus_file(import_path->get_text().get_file().get_basename()+".scn"); print_line("Saving to: "+save_file); @@ -794,7 +794,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) { rim->set_option("root_type",root_type->get_text()); } if (root_node_name->get_text().size()==0) { - root_node_name->set_text(import_path->get_text().get_file().basename()); + root_node_name->set_text(import_path->get_text().get_file().get_basename()); } rim->set_option("root_name",root_node_name->get_text()); @@ -2124,7 +2124,7 @@ Error EditorSceneImportPlugin::import1(const Ref& p_from String src_path=EditorImportPlugin::expand_source_path(from->get_source_path(0)); Ref importer; - String ext=src_path.extension().to_lower(); + String ext=src_path.get_extension().to_lower(); EditorProgress progress("import",TTR("Import Scene"),104); @@ -2821,7 +2821,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c { - target_path=target_path.basename()+".tex"; + target_path=target_path.get_basename()+".tex"; Ref imd = memnew( ResourceImportMetadata ); @@ -2936,7 +2936,7 @@ void EditorSceneImportPlugin::import_from_drop(const Vector& p_drop,cons //bool warn_compatible=false; for(int i=0;i::Element *E=extensions.front();E;E=E->next()) { diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 3bf2551778d..564753ca7bd 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -448,7 +448,7 @@ void EditorTextureImportDialog::_import() { for(int i=0;i imd = memnew( ResourceImportMetadata ); //imd->set_editor(); imd->add_source(EditorImportPlugin::validate_source_path(files[i])); @@ -1307,9 +1307,9 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refget_source_path(E->get()).get_file(); if (p_external) { - apath = p_path.get_base_dir().plus_file(spath.basename()+"."+from->get_source_path(E->get()).md5_text()+".atex"); + apath = p_path.get_base_dir().plus_file(spath.get_basename()+"."+from->get_source_path(E->get()).md5_text()+".atex"); } else { - apath = p_path.get_base_dir().plus_file(spath.basename()+".atex"); + apath = p_path.get_base_dir().plus_file(spath.get_basename()+".atex"); } Ref at; @@ -1597,7 +1597,7 @@ Vector EditorTextureImportPlugin::custom_export(const String& p_path, c rimd->set_option("shrink",group_shrink); rimd->add_source(validated_path,FileAccess::get_md5(p_path)); - } else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) { + } else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.get_extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) { //handled by general image export settings rimd = Ref( memnew( ResourceImportMetadata ) ); @@ -1743,7 +1743,7 @@ void EditorTextureImportPlugin::import_from_drop(const Vector& p_drop,co ImageLoader::get_recognized_extensions(&valid_extensions); for(int i=0;i::Element *E=valid_extensions.front();E;E=E->next()) { @@ -1851,21 +1851,21 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor) { if (pl.is_valid()) { Vector ce = pl->custom_export(p_path,p_platform); if (ce.size()) { - p_path=p_path.basename()+".converted.tex"; + p_path=p_path.get_basename()+".converted.tex"; return ce; } } } else if (EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE){ - String xt = p_path.extension().to_lower(); + String xt = p_path.get_extension().to_lower(); if (EditorImportExport::get_singleton()->get_image_formats().has(xt)) { //should check for more I guess? Ref pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture"); if (pl.is_valid()) { Vector ce = pl->custom_export(p_path,p_platform); if (ce.size()) { - p_path=p_path.basename()+".converted.tex"; + p_path=p_path.get_basename()+".converted.tex"; return ce; } } diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index 73d9e989ac7..90c8e35f6af 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -255,7 +255,7 @@ public: imd->set_option("skip_first",ignore_first->is_pressed()); imd->set_option("compress",compress->is_pressed()); - String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+"."+locale+".xl"); + String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().get_basename()+"."+locale+".xl"); Error err = plugin->import(savefile,imd); if (err!=OK) { error_dialog->set_text(TTR("Couldn't import!")); @@ -400,7 +400,7 @@ void EditorTranslationImportPlugin::import_from_drop(const Vector& p_dro for(int i=0;i& p_resource) if (p_resource->get_path() != "") { file->set_current_path(p_resource->get_path()); if (extensions.size()) { - String ext = p_resource->get_path().extension().to_lower(); + String ext = p_resource->get_path().get_extension().to_lower(); if (extensions.find(ext) == NULL) { file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get())); } diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 0253f656a42..45f97383a39 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3734,7 +3734,7 @@ bool CanvasItemEditorViewport::_cyclical_dependency_exists(const String& p_targe } void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& path, const Point2& p_point) { - child->set_name(path.get_file().basename()); + child->set_name(path.get_file().get_basename()); Ref texture=Ref ( ResourceCache::get(path)->cast_to() ); Size2 texture_size = texture->get_size(); @@ -3875,7 +3875,7 @@ void CanvasItemEditorViewport::_perform_drop_data(){ if (error_files.size()>0) { String files_str; for (int i=0;iget_ok()->set_text(TTR("Ugh")); diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index 92d9c070af4..689cd6a3533 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -79,7 +79,7 @@ void ResourcePreloaderEditor::_files_load_request(const Vector& p_paths) } - String basename = path.get_file().basename(); + String basename = path.get_file().get_basename(); String name=basename; int counter=1; while(preloader->has_resource(name)) { @@ -347,7 +347,7 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2& p_point,const Variant& if (r->get_name()!="") { basename=r->get_name(); } else if (r->get_path().is_resource_file()) { - basename = r->get_path().basename(); + basename = r->get_path().get_basename(); } else { basename="Resource"; } diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index e470d0d2c24..28a44d99f1b 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -81,7 +81,7 @@ void SampleLibraryEditor::_file_load_request(const PoolVector& p_path) { dialog->popup_centered_minsize(); return; ///beh should show an error i guess } - String basename = path.get_file().basename(); + String basename = path.get_file().get_basename(); String name=basename; int counter=0; while(sample_library->has_sample(name)) { @@ -376,7 +376,7 @@ void SampleLibraryEditor::drop_data_fw(const Point2& p_point,const Variant& p_da if (sample->get_name()!="") { basename=sample->get_name(); } else if (sample->get_path().is_resource_file()) { - basename = sample->get_path().basename(); + basename = sample->get_path().get_basename(); } else { basename="Sample"; } diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 7a1b2c518ca..dd3a9c3d385 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -921,7 +921,7 @@ bool ProjectExportDialog::_update_group_treef(TreeItem *p_parent,EditorFileSyste for(int i=0;iget_file_count();i++) { String fname = p_dir->get_file(i); - if (p_extensions.has(fname.to_lower().extension())) { + if (p_extensions.has(fname.to_lower().get_extension())) { String path = p_dir->get_file_path(i); if (filter!=String() && path.find(filter)==-1) diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index d1095271fc6..2a76224e334 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -38,7 +38,7 @@ void ScriptCreateDialog::config(const String& p_base_name,const String&p_base_pa class_name->set_text(""); parent_name->set_text(p_base_name); if (p_base_path!="") { - initial_bp=p_base_path.basename(); + initial_bp=p_base_path.get_basename(); file_path->set_text(initial_bp+"."+ScriptServer::get_language( language_menu->get_selected() )->get_extension()); } else { initial_bp=""; @@ -182,7 +182,7 @@ void ScriptCreateDialog::_lang_changed(int l) { String path=file_path->get_text(); String extension=""; if (path.find(".")>=0) { - extension=path.extension(); + extension=path.get_extension(); } if (extension.length()==0) { @@ -199,7 +199,7 @@ void ScriptCreateDialog::_lang_changed(int l) { for(List::Element *E=extensions.front();E;E=E->next()) { if (E->get().nocasecmp_to(extension)==0) { - path=path.basename()+selected_ext; + path=path.get_basename()+selected_ext; _path_changed(path); break; } @@ -288,7 +288,7 @@ void ScriptCreateDialog::_path_changed(const String& p_path) { create_new=!f->file_exists(p); memdelete(f); - String extension=p.extension(); + String extension=p.get_extension(); List extensions; // get all possible extensions for script