diff --git a/filesystem.hpp b/filesystem.hpp index 9eb0a73..54d49e3 100644 --- a/filesystem.hpp +++ b/filesystem.hpp @@ -1,27 +1,20 @@ #ifndef FSLIB_H #define FSLIB_H -#include +#include #include #ifdef _WIN32 #include -#else - -#include - -#endif - -// set apropriate data types for each operating system -#ifdef _WIN32 - using string = std::wstring; using char_t = wchar_t; #else +#include + using string = std::string; using char_t = char; diff --git a/unix/filesystem.cpp b/unix/filesystem.cpp index 43df3e0..f0019ae 100644 --- a/unix/filesystem.cpp +++ b/unix/filesystem.cpp @@ -6,6 +6,8 @@ FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {} FSLib::Directory::Iterator::Iterator( const Directory &d_ ) : d( opendir( d_.path() ) ) { current_entry = readdir( d ); + + // skip "." and ".." if ( current_entry != nullptr && ( !strcmp( current_entry->d_name, "." ) || !strcmp( current_entry->d_name, ".." ) ) ) @@ -26,9 +28,7 @@ bool FSLib::exists( const string &path ) { } string FSLib::canonical( const string &path ) { - char_t *canonical_path = new char_t[PATH_MAX]; - auto failed = realpath( path.c_str(), canonical_path ) == nullptr; if ( failed ) {