filesystem: fix windows directory iteration

This commit is contained in:
zvon 2020-05-11 14:46:27 +02:00
parent 4507511494
commit de2ef74938
2 changed files with 7 additions and 1 deletions

View File

@ -108,6 +108,12 @@ public:
return dir_path.c_str();
}
#ifdef _WIN32
const char_t *validPath() const {
return dir_path.substr(0, dir_path.length()-2).c_str();
}
#endif
private:
string dir_path;
};

View File

@ -10,7 +10,7 @@ FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {
}
FSLib::Directory::Iterator::Iterator( const Directory &d_ ) {
if ( !exists( d_.path() ) || !isDirectory( d_.path() ) ) {
if ( !exists( d_.validPath() ) || !isDirectory( d_.validPath() ) ) {
throw std::runtime_error(
"Directory either doesn't exist or isn't a directory" );
}