rename String.extension() -> String.get_extension() / String.basename() -> String.get_basename()

This commit is contained in:
Juan Linietsky 2017-01-14 00:51:09 -03:00
parent f3b6177ece
commit d9d77291bc
51 changed files with 113 additions and 113 deletions

View File

@ -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;

View File

@ -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;

View File

@ -36,7 +36,7 @@ bool ImageFormatLoader::recognize(const String& p_extension) const {
get_recognized_extensions(&extensions);
for (List<String>::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<loader_count;i++) {

View File

@ -55,7 +55,7 @@ bool ResourceFormatLoader::recognize(const String& p_extension) const {
get_recognized_extensions(&extensions);
for (List<String>::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<loader_count;i++) {
@ -230,7 +230,7 @@ Ref<ResourceImportMetadata> 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<ResourceImportMetadata> ret;
for (int i=0;i<loader_count;i++) {
@ -331,7 +331,7 @@ Ref<ResourceInteractiveLoader> 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<loader_count;i++) {
@ -385,7 +385,7 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *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;i<loader_count;i++) {
@ -410,7 +410,7 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String,
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<loader_count;i++) {
@ -449,7 +449,7 @@ String ResourceLoader::get_resource_type(const String &p_path) {
local_path = GlobalConfig::get_singleton()->localize_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<loader_count;i++) {

View File

@ -40,7 +40,7 @@ ResourceSavedCallback ResourceSaver::save_callback=0;
Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_flags) {
String extension=p_path.extension();
String extension=p_path.get_extension();
Error err=ERR_FILE_UNRECOGNIZED;
for (int i=0;i<saver_count;i++) {
@ -54,7 +54,7 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_
for (List<String>::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;
}

View File

@ -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 "";
}

View File

@ -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)

View File

@ -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;

View File

@ -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());

View File

@ -1026,7 +1026,7 @@ MainLoop* test(TestType p_test) {
} else if (p_test==TEST_BYTECODE) {
Vector<uint8_t> 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);

View File

@ -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 "";

View File

@ -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 "";
}

View File

@ -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 "";
}

View File

@ -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)) {

View File

@ -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 "";

View File

@ -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;
}
}

View File

@ -366,7 +366,7 @@ void ResourceFormatLoaderAudioStreamOpus::get_recognized_extensions(List<String>
}
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 "";
}

View File

@ -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 "";
}

View File

@ -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 "";
}

View File

@ -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 "";

View File

@ -419,7 +419,7 @@ void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List<St
}
String ResourceFormatLoaderAudioStreamOGGVorbis::get_resource_type(const String &p_path) const {
if (p_path.extension().to_lower()=="ogg")
if (p_path.get_extension().to_lower()=="ogg")
return "AudioStreamOGGVorbis";
return "";
}

View File

@ -415,7 +415,7 @@ bool ResourceFormatLoaderVideoStreamWebm::handles_type(const String &p_type) con
String ResourceFormatLoaderVideoStreamWebm::get_resource_type(const String &p_path) const {
const String exl = p_path.extension().to_lower();
const String exl = p_path.get_extension().to_lower();
if (exl == "webm")
return "VideoStreamWebm";
return "";

View File

@ -265,7 +265,7 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
FileAccess *f=FileAccess::open(p_path.get_base_dir()+"/data.pck",FileAccess::WRITE);
if (!f) {
EditorNode::add_io_error("Could not create file for writing:\n"+p_path.basename()+"_files.js");
EditorNode::add_io_error("Could not create file for writing:\n"+p_path.get_basename()+"_files.js");
return ERR_FILE_CANT_WRITE;
}
Error err = save_pack(f);
@ -307,32 +307,32 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
if (file=="godot.html") {
_fix_html(data,p_path.get_file().basename(), p_debug);
_fix_html(data,p_path.get_file().get_basename(), p_debug);
file=p_path.get_file();
}
if (file=="godotfs.js") {
_fix_files(data,len);
file=p_path.get_file().basename()+"fs.js";
file=p_path.get_file().get_basename()+"fs.js";
}
if (file=="godot.js") {
file=p_path.get_file().basename()+".js";
file=p_path.get_file().get_basename()+".js";
}
if (file=="godot.asm.js") {
file=p_path.get_file().basename()+".asm.js";
file=p_path.get_file().get_basename()+".asm.js";
}
if (file=="godot.mem") {
file=p_path.get_file().basename()+".mem";
file=p_path.get_file().get_basename()+".mem";
}
if (file=="godot.wasm") {
file=p_path.get_file().basename()+".wasm";
file=p_path.get_file().get_basename()+".wasm";
}
String dst = p_path.get_base_dir().plus_file(file);

View File

@ -612,7 +612,7 @@ void AppxPackager::make_content_types() {
for (int i = 0; i < file_metadata.size(); i++) {
String ext = file_metadata[i].name.extension();
String ext = file_metadata[i].name.get_extension();
if (types.has(ext)) continue;

View File

@ -36,7 +36,7 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String& p_origin
if (r_error)
*r_error=ERR_CANT_OPEN;
if (p_path.extension()=="cube") {
if (p_path.get_extension()=="cube") {
// open as cubemap txture
CubeMap* ptr = memnew(CubeMap);
@ -235,7 +235,7 @@ void ResourceFormatLoaderImage::get_recognized_extensions(List<String> *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";

View File

@ -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 "";
}

View File

@ -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 "";

View File

@ -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")

View File

@ -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 "";
}

View File

@ -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 {

View File

@ -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() {

View File

@ -670,7 +670,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
for (List<String>::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

View File

@ -949,7 +949,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
return ERR_CANT_CREATE;
}
Vector<uint8_t> 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)

View File

@ -623,7 +623,7 @@ void EditorNode::save_resource_as(const Ref<Resource>& 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";

View File

@ -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();
}

View File

@ -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();

View File

@ -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<String>& p_drop, c
ImageLoader::get_recognized_extensions(&valid_extensions);
for(int i=0;i<p_drop.size();i++) {
String extension=p_drop[i].extension().to_lower();
String extension=p_drop[i].get_extension().to_lower();
for (List<String>::Element *E=valid_extensions.front();E;E=E->next()) {

View File

@ -42,7 +42,7 @@ Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref<
}
String extension = p_path.extension();
String extension = p_path.get_extension();
//step 1 check if scene

View File

@ -468,7 +468,7 @@ class EditorFontImportDialog : public ConfirmationDialog {
Ref<ImageTexture> 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<CharType> 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<uint8_t> 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<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
String src_path = EditorImportPlugin::expand_source_path(from->get_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<ResourceImp
void EditorFontImportPlugin::import_from_drop(const Vector<String>& p_drop, const String &p_dest_path) {
for(int i=0;i<p_drop.size();i++) {
String ext = p_drop[i].extension().to_lower();
String ext = p_drop[i].get_extension().to_lower();
String file = p_drop[i].get_file();
if (ext=="ttf" || ext=="otf" || ext=="fnt") {
import_dialog();
dialog->set_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;
}
}

View File

@ -2438,7 +2438,7 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String& p_path
Ref<Animation> 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")) {

View File

@ -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<String>& p_drop, cons
Vector<String> files;
for(int i=0;i<p_drop.size();i++) {
String ext = p_drop[i].extension().to_lower();
String ext = p_drop[i].get_extension().to_lower();
String file = p_drop[i].get_file();
if (ext=="obj") {

View File

@ -296,7 +296,7 @@ public:
error_dialog->popup_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<String>& p_drop, co
Vector<String> files;
for(int i=0;i<p_drop.size();i++) {
String ext = p_drop[i].extension().to_lower();
String ext = p_drop[i].get_extension().to_lower();
if (ext=="wav") {
@ -887,7 +887,7 @@ Vector<uint8_t> 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<uint8_t>();
}
@ -911,7 +911,7 @@ Vector<uint8_t> EditorSampleExportPlugin::custom_export(String& p_path,const Ref
ERR_FAIL_COND_V(err!=OK,Vector<uint8_t>());
p_path=p_path.basename()+".converted.smp";
p_path=p_path.get_basename()+".converted.smp";
return FileAccess::get_file_as_array(savepath);
}

View File

@ -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<ResourceImportMetadata>& p_from
String src_path=EditorImportPlugin::expand_source_path(from->get_source_path(0));
Ref<EditorSceneImporter> 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<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
@ -2936,7 +2936,7 @@ void EditorSceneImportPlugin::import_from_drop(const Vector<String>& p_drop,cons
//bool warn_compatible=false;
for(int i=0;i<p_drop.size();i++) {
String extension = p_drop[i].extension().to_lower();
String extension = p_drop[i].get_extension().to_lower();
for(List<String>::Element *E=extensions.front();E;E=E->next()) {

View File

@ -448,7 +448,7 @@ void EditorTextureImportDialog::_import() {
for(int i=0;i<files.size();i++) {
String dst_file = dst_path.plus_file(files[i].get_file());
dst_file=dst_file.basename()+".tex";
dst_file=dst_file.get_basename()+".tex";
Ref<ResourceImportMetadata> 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 Ref<Resourc
String spath = from->get_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<AtlasTexture> at;
@ -1597,7 +1597,7 @@ Vector<uint8_t> 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<ResourceImportMetadata>( memnew( ResourceImportMetadata ) );
@ -1743,7 +1743,7 @@ void EditorTextureImportPlugin::import_from_drop(const Vector<String>& p_drop,co
ImageLoader::get_recognized_extensions(&valid_extensions);
for(int i=0;i<p_drop.size();i++) {
String extension=p_drop[i].extension().to_lower();
String extension=p_drop[i].get_extension().to_lower();
for (List<String>::Element *E=valid_extensions.front();E;E=E->next()) {
@ -1851,21 +1851,21 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor) {
if (pl.is_valid()) {
Vector<uint8_t> 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<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture");
if (pl.is_valid()) {
Vector<uint8_t> 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;
}
}

View File

@ -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<String>& p_dro
for(int i=0;i<p_drop.size();i++) {
String ext = p_drop[i].extension().to_lower();
String ext = p_drop[i].get_extension().to_lower();
if (ext=="csv") {

View File

@ -421,7 +421,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource>& 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()));
}

View File

@ -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<ImageTexture> texture=Ref<ImageTexture> ( ResourceCache::get(path)->cast_to<ImageTexture>() );
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;i<error_files.size();i++) {
files_str += error_files[i].get_file().basename() + ",";
files_str += error_files[i].get_file().get_basename() + ",";
}
files_str=files_str.substr(0,files_str.length()-1);
accept->get_ok()->set_text(TTR("Ugh"));

View File

@ -79,7 +79,7 @@ void ResourcePreloaderEditor::_files_load_request(const Vector<String>& 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";
}

View File

@ -81,7 +81,7 @@ void SampleLibraryEditor::_file_load_request(const PoolVector<String>& 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";
}

View File

@ -921,7 +921,7 @@ bool ProjectExportDialog::_update_group_treef(TreeItem *p_parent,EditorFileSyste
for(int i=0;i<p_dir->get_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)

View File

@ -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<String>::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<String> extensions;
// get all possible extensions for script