do not prefix filenames with slash if in archive directory is empty

This commit is contained in:
ohyzha
2025-02-17 13:53:38 +02:00
parent b644a200ce
commit 475442e086

View File

@@ -80,11 +80,17 @@ namespace OpenVulkano
bool AddFiles(const std::filesystem::path& dirName, const std::string& inArchiveDirName)
{
std::string sDirName = dirName.string();
AddFile(sDirName.c_str(), inArchiveDirName.c_str());
const std::string sDirName = dirName.string();
const std::string prefix = inArchiveDirName.empty() ? "" : inArchiveDirName + "/";
if (!inArchiveDirName.empty())
{
AddFile(sDirName.c_str(), inArchiveDirName.c_str());
}
std::string fPath;
for(const auto& entry : std::filesystem::directory_iterator(dirName))
{
std::string fPath = inArchiveDirName + "/" + entry.path().filename().string();
fPath.clear();
fPath = prefix + entry.path().filename().string();
if (entry.is_directory()) AddFiles(entry, fPath);
else
{