From df9714215782c7b544d62801ab2dacb31b1c5eb4 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 1 Feb 2022 03:20:15 -0500 Subject: [PATCH] fix improper dir sep when loading sample on Win --- src/engine/engine.cpp | 2 +- src/ta-utils.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 4622a65ea..1aef41fee 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4833,7 +4833,7 @@ bool DivEngine::addSampleFromFile(const char* path) { sf_close(f); DivSample* sample=new DivSample; int sampleCount=(int)song.sample.size(); - const char* sName=strrchr(path,'/'); + const char* sName=strrchr(path,DIR_SEPARATOR); if (sName==NULL) { sName=path; } else { diff --git a/src/ta-utils.h b/src/ta-utils.h index a1e2441c1..53b1e4a8c 100644 --- a/src/ta-utils.h +++ b/src/ta-utils.h @@ -9,6 +9,12 @@ typedef SSIZE_T ssize_t; #endif +#ifdef _WIN32 +#define DIR_SEPARATOR '\\' +#else +#define DIR_SEPARATOR '/' +#endif + typedef std::string String; #define MIN(a,b) (((a)<(b))?(a):(b))