Fix usage from C++20

This commit is contained in:
SirLynix 2022-08-03 20:11:25 +02:00
parent 41523f8ca8
commit 09d21b4a45
5 changed files with 13 additions and 12 deletions

View File

@ -68,10 +68,10 @@ namespace Nz
{
NazaraAssert(parameters.IsValid(), "Invalid parameters");
std::string ext = ToLower(filePath.extension().generic_u8string());
std::string ext = ToLower(PathToString(filePath.extension()));
if (ext.empty())
{
NazaraError("Failed to get file extension from \"" + filePath.generic_u8string() + '"');
NazaraError("Failed to get file extension from \"" + PathToString(filePath) + '"');
return nullptr;
}
@ -92,7 +92,7 @@ namespace Nz
{
if (!file.Open(OpenMode::ReadOnly))
{
NazaraError("Failed to load file: unable to open \"" + filePath.generic_u8string() + '"');
NazaraError("Failed to load file: unable to open \"" + PathToString(filePath) + '"');
return nullptr;
}
}

View File

@ -51,11 +51,11 @@ namespace Nz
std::shared_ptr<Type> resource = m_loader.LoadFromFile(absolutePath, GetDefaultParameters());
if (!resource)
{
NazaraError("Failed to load resource from file: " + absolutePath.generic_u8string());
NazaraError("Failed to load resource from file: " + PathToString(absolutePath));
return std::shared_ptr<Type>();
}
NazaraDebug("Loaded resource from file " + absolutePath.generic_u8string());
NazaraDebug("Loaded resource from file " + PathToString(absolutePath));
it = m_resources.insert(std::make_pair(absolutePath, resource)).first;
}

View File

@ -65,10 +65,10 @@ namespace Nz
{
NazaraAssert(parameters.IsValid(), "Invalid parameters");
std::string extension = ToLower(filePath.extension().generic_u8string());
std::string extension = ToLower(PathToString(filePath.extension()));
if (extension.empty())
{
NazaraError("Failed to get file extension from \"" + filePath.generic_u8string() + '"');
NazaraError("Failed to get file extension from \"" + PathToString(filePath) + '"');
return false;
}
@ -95,7 +95,7 @@ namespace Nz
if (!file.Open(OpenMode::WriteOnly | OpenMode::Truncate))
{
NazaraError("Failed to save to file: unable to open \"" + filePath.generic_u8string() + "\" in write mode");
NazaraError("Failed to save to file: unable to open \"" + PathToString(filePath) + "\" in write mode");
return false;
}

View File

@ -10,6 +10,7 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Unicode.hpp>
#include <Nazara/Math/Algorithm.hpp> //< FIXME
#include <Nazara/Utils/Algorithm.hpp>
#include <string>
namespace Nz

View File

@ -96,7 +96,7 @@ Ternary CheckAnimation(Stream& /*stream*/, const AnimationParams& parameters)
std::shared_ptr<Animation> LoadAnimation(Stream& stream, const AnimationParams& parameters)
{
std::string streamPath = stream.GetPath().generic_u8string();
std::string streamPath = Nz::PathToString(stream.GetPath());
FileIOUserdata userdata;
userdata.originalFilePath = (!streamPath.empty()) ? streamPath.data() : StreamPath;
@ -191,7 +191,7 @@ Ternary CheckMesh(Stream& /*stream*/, const MeshParams& parameters)
std::shared_ptr<Mesh> LoadMesh(Stream& stream, const MeshParams& parameters)
{
std::string streamPath = stream.GetPath().generic_u8string();
std::string streamPath = Nz::PathToString(stream.GetPath());
FileIOUserdata userdata;
userdata.originalFilePath = (!streamPath.empty()) ? streamPath.data() : StreamPath;
@ -389,7 +389,7 @@ std::shared_ptr<Mesh> LoadMesh(Stream& stream, const MeshParams& parameters)
aiTextureMapMode mapMode[3];
if (aiGetMaterialTexture(aiMat, aiType, 0, &path, nullptr, nullptr, nullptr, nullptr, &mapMode[0], nullptr) == aiReturn_SUCCESS)
{
matData.SetParameter(textureKey, (stream.GetDirectory() / std::string_view(path.data, path.length)).generic_u8string());
matData.SetParameter(textureKey, PathToString(stream.GetDirectory() / std::string_view(path.data, path.length)));
if (wrapKey)
{
@ -610,7 +610,7 @@ std::shared_ptr<Mesh> LoadMesh(Stream& stream, const MeshParams& parameters)
aiTextureMapMode mapMode[3];
if (aiGetMaterialTexture(aiMat, aiType, 0, &path, nullptr, nullptr, nullptr, nullptr, &mapMode[0], nullptr) == aiReturn_SUCCESS)
{
matData.SetParameter(textureKey, (stream.GetDirectory() / std::string_view(path.data, path.length)).generic_u8string());
matData.SetParameter(textureKey, Nz::PathToString(stream.GetDirectory() / std::string_view(path.data, path.length)));
if (wrapKey)
{