mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 19:51:45 +02:00
Ensure directory enumeration works whether there's a path seperator at the end of the directory or not
This commit is contained in:
@@ -11,8 +11,10 @@
|
|||||||
|
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
#define PATH_SEP "\\"
|
#define PATH_SEP "\\"
|
||||||
|
#define PATH_SEP_CHAR '\\'
|
||||||
#else
|
#else
|
||||||
#define PATH_SEP "/"
|
#define PATH_SEP "/"
|
||||||
|
#define PATH_SEP_CHAR '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//VersionInfoStart
|
//VersionInfoStart
|
||||||
@@ -89,6 +91,8 @@
|
|||||||
|
|
||||||
#define STAMPS_DIR "stamps"
|
#define STAMPS_DIR "stamps"
|
||||||
|
|
||||||
|
#define BRUSH_DIR "Brushes"
|
||||||
|
|
||||||
#define APPDATA_SUBDIR "\\HardWIRED"
|
#define APPDATA_SUBDIR "\\HardWIRED"
|
||||||
|
|
||||||
//Number of unique thumbnails to have in cache at one time
|
//Number of unique thumbnails to have in cache at one time
|
||||||
|
@@ -367,6 +367,9 @@ std::vector<std::string> Client::DirectorySearch(std::string directory, std::str
|
|||||||
std::vector<std::string> Client::DirectorySearch(std::string directory, std::string search, std::vector<std::string> extensions)
|
std::vector<std::string> Client::DirectorySearch(std::string directory, std::string search, std::vector<std::string> extensions)
|
||||||
{
|
{
|
||||||
//Get full file listing
|
//Get full file listing
|
||||||
|
//Normalise directory string, ensure / or \ is present
|
||||||
|
if(*directory.rbegin() != '/' && *directory.rbegin() != '\\')
|
||||||
|
directory += PATH_SEP;
|
||||||
std::vector<std::string> directoryList;
|
std::vector<std::string> directoryList;
|
||||||
#if defined(WIN) && !defined(__GNUC__)
|
#if defined(WIN) && !defined(__GNUC__)
|
||||||
//Windows
|
//Windows
|
||||||
|
Reference in New Issue
Block a user