diff --git a/filesystem.hpp b/filesystem.hpp index 5477673..4e44d63 100644 --- a/filesystem.hpp +++ b/filesystem.hpp @@ -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; }; diff --git a/windows/filesystem.cpp b/windows/filesystem.cpp index 43d37f2..2a11abc 100644 --- a/windows/filesystem.cpp +++ b/windows/filesystem.cpp @@ -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" ); }