Move sound bank dumping code into separate files

This commit is contained in:
Jan
2023-12-05 23:52:04 +01:00
parent 3a825d1440
commit 55f97267ff
7 changed files with 678 additions and 602 deletions

View File

@ -0,0 +1,34 @@
#include "SoundCommon.h"
#include <filesystem>
namespace fs = std::filesystem;
namespace T6::sound
{
const std::string PREFIXES_TO_DROP[]{
"raw/",
"devraw/",
};
_NODISCARD std::string GetAssetFilename(const std::string& basePath, std::string outputFileName, const std::string& extension)
{
fs::path assetPath(basePath);
std::replace(outputFileName.begin(), outputFileName.end(), '\\', '/');
for (const auto& droppedPrefix : PREFIXES_TO_DROP)
{
if (outputFileName.rfind(droppedPrefix, 0) != std::string::npos)
{
outputFileName.erase(0, droppedPrefix.size());
break;
}
}
assetPath.append(outputFileName);
if (!extension.empty())
assetPath.concat(extension);
return assetPath.string();
}
}