From af29942117a828e244195a530d2aa40fa9b2a5e2 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sun, 18 Nov 2012 18:02:28 +0000 Subject: [PATCH] Ensure directory enumeration works whether there's a path seperator at the end of the directory or not --- src/Config.h | 4 ++++ src/client/Client.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/Config.h b/src/Config.h index 5d2a1a5cf..d30c9b145 100644 --- a/src/Config.h +++ b/src/Config.h @@ -11,8 +11,10 @@ #ifdef WIN #define PATH_SEP "\\" +#define PATH_SEP_CHAR '\\' #else #define PATH_SEP "/" +#define PATH_SEP_CHAR '/' #endif //VersionInfoStart @@ -89,6 +91,8 @@ #define STAMPS_DIR "stamps" +#define BRUSH_DIR "Brushes" + #define APPDATA_SUBDIR "\\HardWIRED" //Number of unique thumbnails to have in cache at one time diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 763814a35..bde66d229 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -367,6 +367,9 @@ std::vector Client::DirectorySearch(std::string directory, std::str std::vector Client::DirectorySearch(std::string directory, std::string search, std::vector extensions) { //Get full file listing + //Normalise directory string, ensure / or \ is present + if(*directory.rbegin() != '/' && *directory.rbegin() != '\\') + directory += PATH_SEP; std::vector directoryList; #if defined(WIN) && !defined(__GNUC__) //Windows