From 717808e7965f9a3e3fad85713a9e49dc115a35b2 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Tue, 18 Jun 2019 10:55:17 +0200 Subject: [PATCH] Updated for the linux case. --- dll/local_storage.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp index c68979f..b701b26 100644 --- a/dll/local_storage.cpp +++ b/dll/local_storage.cpp @@ -217,7 +217,7 @@ static std::vector get_filenames_recursive(std::string base_pa path += dir_name; std::vector lower = get_filenames_recursive(path); - // output.push_back(File_Data{ dir_name }); Is this needed ? Add folder name to the list of files ? + output.push_back(File_Data{ dir_name });// Is this needed ? Add folder name to the list of files ? std::transform(lower.begin(), lower.end(), std::back_inserter(output), [dir_name](File_Data f) {f.name = dir_name + "\\" + f.name; return f;}); } else { File_Data f; @@ -587,11 +587,19 @@ bool Local_Storage::file_exists(std::string folder, std::string file) std::string full_path = save_directory + appid + folder + file; struct stat buffer; - - if (GetFileAttributes(full_path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) + + if (stat(full_path.c_str(), &buffer) != 0) return false; - return (stat (full_path.c_str(), &buffer) == 0); +#if defined(STEAM_WIN32) + if ( buffer.st_mode & _S_IFDIR) + return false; +#else + if (S_ISDIR(buffer.st_mode)) + return false; +#endif + + return true; } unsigned int Local_Storage::file_size(std::string folder, std::string file)