File path separators are a common pain point when writing cross platform software. Of course, not every programming language has a graceful API for handling that. For example, prior to C++ 17, you had to do some #ifdef preprocessor magic to handle that. Which people usually did (or they'd use the Boost suite of libraries).
Code like this wouldn't be out of place or incorrect:
#if defined(WIN32) || defined(_WIN32)
#define PATH_SEPARATOR "\\"
#else
#define PATH_SEPARATOR "/"
#endif
Do I like it? No. But now I've got a pre-processor constant that I can use to assemble my paths in a way that will work across different file path conventions.
Of course, that's the "normal" solution. You could, if you wanted, to it completely wrong. That's what Xian's predecessor did.
#ifdef UNIX
filename += "/";
#else
filename += "\\";
#endif
filename += (*exSeq)[i].path;
#ifdef WIN32
ReplaceAll(filename, "/", "\\");
#else
ReplaceAll(filename, "\\", "/");
#endif
If we're compiling for unix, append a "/" to the filename. Otherwise, append a "\". Then we append a path out of an array. Then, if we're on Windows, find all the "/" in our filename and replace them with "\". Otherwise, find all the "\" in our filename and replace them with "/".
Instead of defining a constant and using it everywhere you need to construct paths, this code was copy/pasted everywhere you needed to append a path separator onto your string. Well, almost everywhere. Clearly, we don't know that the contents of (*exSeq)[i].path are correct for our target operating system, hence we have to do the ReplaceAll call to sanitize it. Why didn't we sanitize the portion we're appending instead of the whole filename (which presumably is already sanitized?)? A better question: is this running inside of a loop? It looks like it is, based on the [i] array access there.
Multiple developers have copy/pasted this code into multiple places. Not one of them gave a shot at refactoring it. And somehow, there are still code paths that output the wrong path separator sometimes, though at least modern Windows is forgiving about that.