diff --git a/lib/filelister_win32.cpp b/lib/filelister_win32.cpp
index 8c4a997dd..58a55e9af 100644
--- a/lib/filelister_win32.cpp
+++ b/lib/filelister_win32.cpp
@@ -16,8 +16,6 @@
* along with this program. If not, see .
*/
-#include "filelister.h"
-#include "filelister_win32.h"
#include
#include
#include
@@ -25,6 +23,10 @@
#include
#include
+#include "filelister.h"
+#include "filelister_win32.h"
+#include "path.h"
+
#if defined(_WIN32)
#include
#ifndef __BORLANDC__
@@ -102,8 +104,7 @@ void FileListerWin32::recursiveAddFiles(std::vector &filenames, con
// It always has a trailing backslash available for concatenation.
std::ostringstream bdir, oss;
- std::string cleanedPath = path;
- std::replace(cleanedPath.begin(), cleanedPath.end(), '/', '\\');
+ std::string cleanedPath = Path::toNativeSeparators(path);
oss << cleanedPath;
@@ -160,7 +161,10 @@ void FileListerWin32::recursiveAddFiles(std::vector &filenames, con
// If recursive is not used, accept all files given by user
if (!recursive || FileLister::acceptFile(ansiFfd))
- filenames.push_back(fname.str());
+ {
+ const std::string nativename = Path::fromNativeSeparators(fname.str());
+ filenames.push_back(nativename);
+ }
}
else if (recursive)
{