Skip to content

Commit c52ae1d

Browse files
committed
[0.2.4] Added First Time Installer
1 parent a88c387 commit c52ae1d

8 files changed

Lines changed: 600 additions & 2 deletions

File tree

Geometria/Files/Files.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
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>
@@ -12,6 +11,7 @@
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+
360385
std::string Files::WhereIs(std::string name)
361386
{
362387
std::string result;

Geometria/Files/Files.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
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);

0 commit comments

Comments
 (0)