summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/spriteloader/png.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/spriteloader/png.cpp b/src/spriteloader/png.cpp
index 92e0c6d76..e72f44010 100644
--- a/src/spriteloader/png.cpp
+++ b/src/spriteloader/png.cpp
@@ -39,7 +39,9 @@ static bool OpenPNGFile(const char *filename, uint32 id, bool mask)
{
char png_file[MAX_PATH];
- snprintf(png_file, sizeof(png_file), "sprites" PATHSEP "%s" PATHSEP "%d%s.png", filename, id, mask ? "m" : "");
+ /* Add path separator after 'sprites' if not present */
+ const char *sep = (filename[0] == PATHSEPCHAR) ? "" : PATHSEP;
+ snprintf(png_file, sizeof(png_file), "sprites%s%s" PATHSEP "%d%s.png", sep, filename, id, mask ? "m" : "");
if (FioCheckFileExists(png_file)) {
FioOpenFile(PNG_SLOT, png_file);
return true;