fix path issues

This commit is contained in:
2026-03-17 00:47:36 -04:00
parent a83dbd5b6c
commit 4f5966dad6
3 changed files with 6 additions and 7 deletions
+4 -2
View File
@@ -91,9 +91,10 @@ namespace anm2ed::anm2
Spritesheet::Spritesheet(const std::filesystem::path& directory, const std::filesystem::path& path)
{
WorkingDirectory workingDirectory(directory);
auto loadPath = !path.empty() ? path::lower_case_backslash_handle(path) : this->path;
this->path = !path.empty() ? path::make_relative(path) : this->path;
this->path = path::lower_case_backslash_handle(this->path);
texture = Texture(this->path);
texture = Texture(!loadPath.empty() ? loadPath : this->path);
}
XMLElement* Spritesheet::to_element(XMLDocument& document, int id, Flags flags)
@@ -234,9 +235,10 @@ namespace anm2ed::anm2
void Spritesheet::reload(const std::filesystem::path& directory, const std::filesystem::path& path)
{
WorkingDirectory workingDirectory(directory);
auto loadPath = !path.empty() ? path::lower_case_backslash_handle(path) : this->path;
this->path = !path.empty() ? path::make_relative(path) : this->path;
this->path = path::lower_case_backslash_handle(this->path);
texture = Texture(this->path);
texture = Texture(!loadPath.empty() ? loadPath : this->path);
}
bool Spritesheet::is_valid() { return texture.is_valid(); }