Optimize String usage with StringView for basic file paths operations
This commit is contained in:
@@ -1085,10 +1085,12 @@ bool ModelTool::ImportDataOpenFBX(const char* path, ImportedModelData& data, con
|
||||
aFilename.toString(filenameData);
|
||||
if (outputPath.IsEmpty())
|
||||
{
|
||||
outputPath = StringUtils::GetDirectoryName(String(path)) / TEXT("textures");
|
||||
String pathStr(path);
|
||||
outputPath = String(StringUtils::GetDirectoryName(pathStr)) / TEXT("textures");
|
||||
FileSystem::CreateDirectory(outputPath);
|
||||
}
|
||||
String embeddedPath = outputPath / StringUtils::GetFileName(String(filenameData));
|
||||
const String filenameStr(filenameData);
|
||||
String embeddedPath = outputPath / StringUtils::GetFileName(filenameStr);
|
||||
if (FileSystem::FileExists(embeddedPath))
|
||||
continue;
|
||||
LOG(Info, "Extracing embedded resource to {0}", embeddedPath);
|
||||
|
||||
@@ -487,7 +487,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& meshData, Options opt
|
||||
// Auto-import textures
|
||||
if (autoImportOutput.IsEmpty() || (data.Types & ImportDataTypes::Textures) == 0 || texture.FilePath.IsEmpty())
|
||||
continue;
|
||||
auto filename = StringUtils::GetFileNameWithoutExtension(texture.FilePath);
|
||||
String filename = StringUtils::GetFileNameWithoutExtension(texture.FilePath);
|
||||
for (int32 j = filename.Length() - 1; j >= 0; j--)
|
||||
{
|
||||
if (EditorUtilities::IsInvalidPathChar(filename[j]))
|
||||
@@ -498,7 +498,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& meshData, Options opt
|
||||
int32 counter = 1;
|
||||
do
|
||||
{
|
||||
filename = StringUtils::GetFileNameWithoutExtension(texture.FilePath) + TEXT(" ") + StringUtils::ToString(counter);
|
||||
filename = String(StringUtils::GetFileNameWithoutExtension(texture.FilePath)) + TEXT(" ") + StringUtils::ToString(counter);
|
||||
counter++;
|
||||
} while (importedFileNames.Contains(filename));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user