Skip to content

Commit

Permalink
fix(io): Ensure the path separator in the PackageFileSystem is alwa…
Browse files Browse the repository at this point in the history
…ys `/`.
  • Loading branch information
na2axl committed Oct 26, 2024
1 parent 13a4abf commit b2103f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/IO/PackageFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ namespace SparkyStudios::Audio::Amplitude

AmOsString PackageFileSystem::ResolvePath(const AmOsString& path) const
{
return std::filesystem::path(path).lexically_normal().native();
auto resolvedPath= std::filesystem::path(path).lexically_normal().native();
std::ranges::replace(resolvedPath, '\\', '/');
return resolvedPath;
}

bool PackageFileSystem::Exists(const AmOsString& path) const
Expand Down
4 changes: 3 additions & 1 deletion tools/ampk/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ static int process(const AmOsString& inFileName, const AmOsString& outFileName,
DiskFile diskFile(absolute(file));

PackageFileItemDescription item;
item.m_Name = relative(absolute(file), projectPath).string();
std::string relativePath = relative(absolute(file), projectPath).string();
std::ranges::replace(relativePath, '\\', '/');
item.m_Name = relativePath;
item.m_Offset = lastOffset;
item.m_Size = diskFile.Length();

Expand Down

0 comments on commit b2103f6

Please sign in to comment.