summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/DriveUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/DriveUtil.cpp')
-rw-r--r--Source/Core/Common/Src/DriveUtil.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/Core/Common/Src/DriveUtil.cpp b/Source/Core/Common/Src/DriveUtil.cpp
index f5e18904b5..e76b646c31 100644
--- a/Source/Core/Common/Src/DriveUtil.cpp
+++ b/Source/Core/Common/Src/DriveUtil.cpp
@@ -16,33 +16,31 @@
// http://code.google.com/p/dolphin-emu/
#include <string>
-
-#include "Common.h"
#include "DriveUtil.h"
#ifdef _WIN32
#include <windows.h>
#include <winioctl.h>
+#elif defined(__GNUC__) // TODO: replace these with real linux / os x functinos
+#define GetLogicalDriveStrings(x, y) (int)memcpy(y,"/dev/cdrom\0/dev/cdrom1\0/dev/cdrom2\0/dev/cdrom3\0/dev/cdrom4\0/dev/cdrom5\0/dev/cdrom6\0/dev/cdrom7\0/dev/cdrom8\0/dev/cdrom9\0\0\0", 121);
+#else
+#define GetLogicalDriveStrings(x, y) (int)memcpy(y,"/dev/disk2\0/dev/disk3\0/dev/disk4\0/dev/disk5\0/dev/disk6\0/dev/disk7\0/dev/disk8\0/dev/disk9\0/dev/disk10\0/dev/disk11\0\0\0",114);
#endif
void GetAllRemovableDrives(std::vector<std::string> *drives) {
drives->clear();
-#ifdef _WIN32
char drives_string[1024];
int max_drive_pos = GetLogicalDriveStrings(1024, drives_string);
+
char *p = drives_string;
// GetLogicalDriveStrings returns the drives as a a series of null-terminated strings
// laid out right after each other in RAM, with a double null at the end.
while (*p)
{
- if (GetDriveType(p) == DRIVE_CDROM) // CD_ROM also applies to DVD. Noone has a plain CDROM without DVD anymore so we should be fine.
+ if (File::IsDisk(p))
{
- drives->push_back(std::string(p).substr(0, 2));
+ drives->push_back(std::string(p));
}
p += strlen(p) + 1;
}
-#else
- // TODO
- // stat("/media/cdrom") or whatever etc etc
-#endif
}