File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#include " Files.h"
22#include " Image/lodepng.h"
33#include " Scene/SceneFile.h"
4- #include " nlohmann/json.hpp"
54#include < experimental/filesystem>
65#include < cstdio>
76#include < memory>
1211#ifdef _WIN32
1312#include < Windows.h>
1413#include < direct.h>
14+ #include < fileapi.h>
1515#define POPEN _popen
1616#define PCLOSE _pclose
1717#endif
@@ -357,6 +357,31 @@ std::string Files::GetFilenameFromDirectory(const char* dir)
357357 return dirString.substr (dirString.find_last_of (" /\\ " ) + 1 );
358358}
359359
360+ std::vector<std::string> Files::GetListOfDrives ()
361+ {
362+ std::vector<std::string> driveList;
363+
364+ #ifdef _WIN32
365+ DWORD dwSize = MAX_PATH ;
366+ WCHAR szLogicalDrives[MAX_PATH ] = { 0 };
367+ DWORD dwResult = GetLogicalDriveStrings (dwSize, szLogicalDrives);
368+
369+ if (dwResult > 0 && dwResult <= MAX_PATH )
370+ {
371+ WCHAR * szSingleDrive = szLogicalDrives;
372+ while (*szSingleDrive)
373+ {
374+ driveList.push_back (std::string ((char *)szSingleDrive) + " :" );
375+
376+ // get the next drive
377+ szSingleDrive += wcslen (szSingleDrive) + 1 ;
378+ }
379+ }
380+ #endif
381+
382+ return driveList;
383+ }
384+
360385std::string Files::WhereIs (std::string name)
361386{
362387 std::string result;
Original file line number Diff line number Diff line change 55#include < string>
66#include < sstream>
77#include < vector>
8+ #include " nlohmann/json.hpp"
89#include " Trenchbroom/Trenchbroom.h"
910
1011#ifdef _WIN32
@@ -51,6 +52,8 @@ struct Files
5152 static std::string GetDirectoryOf (const char * file);
5253 static std::string GetFilenameFromDirectory (const char * dir);
5354
55+ static std::vector<std::string> GetListOfDrives ();
56+
5457 static std::string GetGamePath ();
5558
5659 static std::string WhereIs (std::string name);
You can’t perform that action at this time.
0 commit comments