summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/CDUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/CDUtils.cpp')
-rw-r--r--Source/Core/Common/Src/CDUtils.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/Core/Common/Src/CDUtils.cpp b/Source/Core/Common/Src/CDUtils.cpp
index 42aa9bfe34..9a302b9189 100644
--- a/Source/Core/Common/Src/CDUtils.cpp
+++ b/Source/Core/Common/Src/CDUtils.cpp
@@ -6,6 +6,7 @@
#include <memory> // for std::unique_ptr
#ifdef _WIN32
#include <windows.h>
+#include "StringUtil.h"
#elif __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOBSD.h>
@@ -25,7 +26,7 @@
#ifdef _WIN32
// takes a root drive path, returns true if it is a cdrom drive
-bool is_cdrom(const char drive[])
+bool is_cdrom(const TCHAR* drive)
{
return (DRIVE_CDROM == GetDriveType(drive));
}
@@ -36,15 +37,15 @@ std::vector<std::string> cdio_get_devices()
std::vector<std::string> drives;
const DWORD buffsize = GetLogicalDriveStrings(0, NULL);
- std::unique_ptr<char[]> buff(new char[buffsize]);
- if (GetLogicalDriveStrings(buffsize, buff.get()) == buffsize - 1)
+ std::vector<TCHAR> buff(buffsize);
+ if (GetLogicalDriveStrings(buffsize, buff.data()) == buffsize - 1)
{
- const char* drive = buff.get();
+ auto drive = buff.data();
while (*drive)
{
if (is_cdrom(drive))
{
- std::string str(drive);
+ std::string str(TStrToUTF8(drive));
str.pop_back(); // we don't want the final backslash
drives.push_back(std::move(str));
}