summaryrefslogtreecommitdiff
path: root/tools/asset_packer.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-13 08:34:24 +0100
committerskal <pascal.massimino@gmail.com>2026-02-13 08:34:24 +0100
commita109983c194c45ad85f0e481232bc605c7cfd85b (patch)
tree2b2fadb054fb8ea52d3e31fefdc4678d5a3ed7dc /tools/asset_packer.cc
parent3ce45fcf073047d71ed0b2c88f4d6c5362f6b620 (diff)
Remediation: Implement shared common/shaders/ directory
Eliminates 36 duplicate shader files across workspaces. Structure: - common/shaders/{math,render,compute}/ - Shared utilities (20 files) - workspaces/*/shaders/ - Workspace-specific only Changes: - Created common/shaders/ with math, render, compute subdirectories - Moved 20 common shaders from workspaces to common/ - Removed duplicates from test workspace - Updated assets.txt: ../../common/shaders/ references - Enhanced asset_packer.cc: filesystem path normalization for ../ resolution Implementation: Option 1 from SHADER_REUSE_INVESTIGATION.md - Single source of truth for common code - Workspace references via relative paths - Path normalization in asset packer handoff(Claude): Common shader directory implemented
Diffstat (limited to 'tools/asset_packer.cc')
-rw-r--r--tools/asset_packer.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc
index 4aaa0e7..5646716 100644
--- a/tools/asset_packer.cc
+++ b/tools/asset_packer.cc
@@ -6,6 +6,7 @@
#include <cmath>
#include <cstdio> // for simplicity, use fprintf() for output generation
#include <cstring> // For std::memcpy
+#include <filesystem> // For path normalization
#include <fstream>
#include <map>
#include <regex> // For std::regex
@@ -320,7 +321,9 @@ int main(int argc, char* argv[]) {
if (!info.is_procedural) {
std::string base_dir =
assets_txt_path.substr(0, assets_txt_path.find_last_of("/\\") + 1);
- std::string full_path = base_dir + info.filename;
+ std::filesystem::path base_path = std::filesystem::absolute(base_dir);
+ std::filesystem::path combined_path = base_path / info.filename;
+ std::string full_path = combined_path.lexically_normal().string();
std::vector<uint8_t> buffer;
bool is_image = HasImageExtension(info.filename);