mirror of https://github.com/axmolengine/axmol.git
Rename FileUtils::getFileExtension to getPathExtension
This commit is contained in:
parent
23a0132203
commit
dfa68a4cdf
|
@ -181,7 +181,7 @@ bool Bundle3D::load(std::string_view path)
|
|||
getModelRelativePath(path);
|
||||
|
||||
bool ret = false;
|
||||
std::string ext = FileUtils::getInstance()->getFileExtension(path);
|
||||
std::string ext = FileUtils::getPathExtension(path);
|
||||
if (ext == ".c3t")
|
||||
{
|
||||
_isBinary = false;
|
||||
|
@ -2274,7 +2274,7 @@ std::vector<Vec3> Bundle3D::getTrianglesList(std::string_view path)
|
|||
return trianglesList;
|
||||
|
||||
auto bundle = Bundle3D::createBundle();
|
||||
std::string ext = FileUtils::getInstance()->getFileExtension(path);
|
||||
std::string ext = FileUtils::getPathExtension(path);
|
||||
MeshDatas meshs;
|
||||
if (ext == ".obj")
|
||||
{
|
||||
|
|
|
@ -240,7 +240,7 @@ bool MeshRenderer::loadFromFile(std::string_view path,
|
|||
{
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
||||
|
||||
std::string ext = FileUtils::getInstance()->getFileExtension(path);
|
||||
std::string ext = FileUtils::getPathExtension(path);
|
||||
if (ext == ".obj")
|
||||
{
|
||||
return Bundle3D::loadObj(*meshdatas, *materialdatas, *nodedatas, fullPath);
|
||||
|
|
|
@ -1343,7 +1343,7 @@ bool FileUtils::isPopupNotify() const
|
|||
return s_popupNotify;
|
||||
}
|
||||
|
||||
std::string FileUtils::getFileExtension(std::string_view filePath)
|
||||
std::string FileUtils::getPathExtension(std::string_view filePath)
|
||||
{
|
||||
std::string fileExtension;
|
||||
size_t pos = filePath.find_last_of('.');
|
||||
|
|
|
@ -565,7 +565,8 @@ public:
|
|||
* @param filePath The path of the file, it could be a relative or absolute path.
|
||||
* @return suffix for filename in lower case or empty if a dot not found.
|
||||
*/
|
||||
static std::string getFileExtension(std::string_view filePath);
|
||||
AX_DEPRECATED_ATTRIBUTE static std::string getFileExtension(std::string_view filePath) { return getPathExtension(filePath); }
|
||||
static std::string getPathExtension(std::string_view filePath);
|
||||
|
||||
/**
|
||||
* Gets filename shotName
|
||||
|
|
|
@ -1437,7 +1437,7 @@ bool Image::initWithTGAData(tImageTGA* tgaData)
|
|||
|
||||
if (ret)
|
||||
{
|
||||
if (FileUtils::getInstance()->getFileExtension(_filePath) != ".tga")
|
||||
if (FileUtils::getPathExtension(_filePath) != ".tga")
|
||||
{
|
||||
AXLOGW("Image WARNING: the image file suffix is not tga, but parsed as a tga image file. FILE: {}",
|
||||
_filePath);
|
||||
|
@ -2318,7 +2318,7 @@ bool Image::saveToFile(std::string_view filename, bool isToRGB)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string fileExtension = FileUtils::getInstance()->getFileExtension(filename);
|
||||
std::string fileExtension = FileUtils::getPathExtension(filename);
|
||||
|
||||
if (fileExtension == ".png")
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ int iterPath(const char* fpath, const struct stat* /*sb*/, int typeflag)
|
|||
{
|
||||
if (typeflag == FTW_F)
|
||||
{
|
||||
if (FileUtils::getInstance()->getFileExtension(fpath) == ".material")
|
||||
if (FileUtils::getPathExtension(fpath) == ".material")
|
||||
PUMaterialCache::Instance()->loadMaterials(fpath);
|
||||
}
|
||||
return 0;
|
||||
|
@ -171,7 +171,7 @@ bool PUMaterialCache::loadMaterialsFromSearchPaths(std::string_view fileFolder)
|
|||
std::string fullpath;
|
||||
while ((fileName = AAssetDir_getNextFileName(dir)) != nullptr)
|
||||
{
|
||||
if (FileUtils::getInstance()->getFileExtension(fileName) == ".material")
|
||||
if (FileUtils::getPathExtension(fileName) == ".material")
|
||||
{
|
||||
fullpath.assign(fileFolder).append(seg).append(fileName);
|
||||
loadMaterials(fullpath);
|
||||
|
@ -198,7 +198,7 @@ bool PUMaterialCache::loadMaterialsFromSearchPaths(std::string_view fileFolder)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (FileUtils::getInstance()->getFileExtension(file->d_name) == ".material")
|
||||
if (FileUtils::getPathExtension(file->d_name) == ".material")
|
||||
{
|
||||
std::string fullpath{fileFolder};
|
||||
fullpath.append("/"sv).append(file->d_name);
|
||||
|
|
|
@ -195,7 +195,7 @@ AssetsManager::AssetsManager(const char* packageUrl /* =nullptr */,
|
|||
|
||||
// progress callback
|
||||
_downloader->onTaskProgress = [this](const DownloadTask& task) {
|
||||
if (FileUtils::getInstance()->getFileExtension(task.requestURL) != ".zip")
|
||||
if (FileUtils::getPathExtension(task.requestURL) != ".zip")
|
||||
{
|
||||
// get version progress don't report
|
||||
return;
|
||||
|
@ -236,7 +236,7 @@ AssetsManager::AssetsManager(const char* packageUrl /* =nullptr */,
|
|||
// 1. Urls of package and version should be valid;
|
||||
// 2. Package should be a zip file.
|
||||
if (_versionFileUrl.empty() || _packageUrl.empty() ||
|
||||
FileUtils::getInstance()->getFileExtension(_packageUrl) != ".zip")
|
||||
FileUtils::getPathExtension(_packageUrl) != ".zip")
|
||||
{
|
||||
AXLOGD("no version file url, or no package url, or the package is not a zip file");
|
||||
_isDownloading = false;
|
||||
|
|
|
@ -196,7 +196,7 @@ bool ComRender::serialize(void* r)
|
|||
}
|
||||
else if (strcmp(className, "CCArmature") == 0)
|
||||
{
|
||||
std::string fileExtension = FileUtils::getInstance()->getFileExtension(filePath);
|
||||
std::string fileExtension = FileUtils::getPathExtension(filePath);
|
||||
if (fileExtension == ".json" || fileExtension == ".exportjson")
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
|
@ -301,7 +301,7 @@ bool ComRender::serialize(void* r)
|
|||
}
|
||||
else if (strcmp(className, "GUIComponent") == 0)
|
||||
{
|
||||
std::string fileExtension = FileUtils::getInstance()->getFileExtension(filePath);
|
||||
std::string fileExtension = FileUtils::getPathExtension(filePath);
|
||||
if (fileExtension == ".json" || fileExtension == ".exportjson")
|
||||
{
|
||||
ax::ui::Widget* widget = GUIReader::getInstance()->widgetFromJsonFile(filePath.c_str());
|
||||
|
|
|
@ -287,7 +287,7 @@ void DataReaderHelper::addDataFromFile(std::string_view filePath)
|
|||
basefilePath = filePath.substr(0, pos + 1);
|
||||
}
|
||||
|
||||
std::string fileExtension = ax::FileUtils::getInstance()->getFileExtension(filePath);
|
||||
std::string fileExtension = ax::FileUtils::getPathExtension(filePath);
|
||||
|
||||
// Read content from file
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||
|
@ -390,7 +390,7 @@ void DataReaderHelper::addDataFromFileAsync(std::string_view imagePath,
|
|||
data->imagePath = imagePath;
|
||||
data->plistPath = plistPath;
|
||||
|
||||
std::string fileExtension = ax::FileUtils::getInstance()->getFileExtension(filePath);
|
||||
std::string fileExtension = ax::FileUtils::getPathExtension(filePath);
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||
|
||||
bool isbinaryfilesrc = fileExtension == ".csb";
|
||||
|
|
|
@ -56,7 +56,7 @@ ax::Node* SceneReader::createNodeWithSceneFile(
|
|||
std::string_view fileName,
|
||||
AttachComponentType attachComponent /*= AttachComponentType::EMPTY_NODE*/)
|
||||
{
|
||||
std::string fileExtension = ax::FileUtils::getInstance()->getFileExtension(fileName);
|
||||
std::string fileExtension = ax::FileUtils::getPathExtension(fileName);
|
||||
if (fileExtension == ".json")
|
||||
{
|
||||
_node = nullptr;
|
||||
|
|
|
@ -41,7 +41,7 @@ SpineSkeletonDataCache::SkeletonData* SpineSkeletonDataCache::addData(const char
|
|||
spine::AttachmentLoader* loader = nullptr;
|
||||
bool ok = false;
|
||||
|
||||
auto fileExtension = ax::FileUtils::getInstance()->getFileExtension(dataFile);
|
||||
auto fileExtension = ax::FileUtils::getPathExtension(dataFile);
|
||||
|
||||
static spine::AxmolTextureLoader s_textureLoader;
|
||||
|
||||
|
@ -174,7 +174,7 @@ SpineSkeletonDataCache::SkeletonData* SpineSkeletonDataCache::addData(const char
|
|||
spAttachmentLoader* loader = nullptr;
|
||||
bool ok = false;
|
||||
|
||||
auto fileExtension = ax::FileUtils::getInstance()->getFileExtension(dataFile);
|
||||
auto fileExtension = ax::FileUtils::getPathExtension(dataFile);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
@ -199,7 +199,7 @@ void GLoader3D::loadFromPackage()
|
|||
if (!ToolSet::isFileExist(atlasFile))
|
||||
atlasFile = _contentItem->file.substr(0, pos + 1).append("atlas.txt");
|
||||
spine::SkeletonAnimation* skeletonAni;
|
||||
if (FileUtils::getInstance()->getFileExtension(_contentItem->file) == ".skel")
|
||||
if (FileUtils::getPathExtension(_contentItem->file) == ".skel")
|
||||
skeletonAni = spine::SkeletonAnimation::createWithBinaryFile(_contentItem->file, atlasFile);
|
||||
else
|
||||
skeletonAni = spine::SkeletonAnimation::createWithJsonFile(_contentItem->file, atlasFile);
|
||||
|
|
|
@ -627,7 +627,7 @@ void UIPackage::loadAtlas(PackageItem* item)
|
|||
delete image;
|
||||
|
||||
string alphaFilePath;
|
||||
string ext = FileUtils::getInstance()->getFileExtension(item->file);
|
||||
string ext = FileUtils::getPathExtension(item->file);
|
||||
size_t pos = item->file.find_last_of('.');
|
||||
if (pos != -1)
|
||||
alphaFilePath = item->file.substr(0, pos) + "!a" + ext;
|
||||
|
|
|
@ -45,7 +45,7 @@ LuaSkeletonAnimation* LuaSkeletonAnimation::createWithFile(const char* skeletonD
|
|||
float scale)
|
||||
{
|
||||
LuaSkeletonAnimation* node = new LuaSkeletonAnimation();
|
||||
if (FileUtils::getInstance()->getFileExtension(skeletonDataFile) == ".json")
|
||||
if (FileUtils::getPathExtension(skeletonDataFile) == ".json")
|
||||
node->initWithJsonFile(skeletonDataFile, atlasFile, scale);
|
||||
else
|
||||
node->initWithBinaryFile(skeletonDataFile, atlasFile, scale);
|
||||
|
|
Loading…
Reference in New Issue