CDUtils: Namespace code under the Common namespace
This commit is contained in:
parent
5fdf171967
commit
1f75fa0aff
|
@ -34,6 +34,8 @@
|
|||
#include <linux/cdrom.h>
|
||||
#endif
|
||||
|
||||
namespace Common
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// takes a root drive path, returns true if it is a cdrom drive
|
||||
bool is_cdrom(const TCHAR* drive)
|
||||
|
@ -219,3 +221,4 @@ bool cdio_is_cdrom(std::string device)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace Common
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
// Returns a pointer to an array of strings with the device names
|
||||
std::vector<std::string> cdio_get_devices();
|
||||
|
||||
// Returns true if device is cdrom/dvd
|
||||
bool cdio_is_cdrom(std::string device);
|
||||
} // namespace Common
|
||||
|
|
|
@ -62,7 +62,7 @@ std::unique_ptr<BootParameters>
|
|||
BootParameters::GenerateFromFile(const std::string& path,
|
||||
const std::optional<std::string>& savestate_path)
|
||||
{
|
||||
const bool is_drive = cdio_is_cdrom(path);
|
||||
const bool is_drive = Common::cdio_is_cdrom(path);
|
||||
// Check if the file exist, we may have gotten it from a --elf command line
|
||||
// that gave an incorrect file name
|
||||
if (!is_drive && !File::Exists(path))
|
||||
|
|
|
@ -176,7 +176,7 @@ u32 SectorReader::ReadChunk(u8* buffer, u64 chunk_num)
|
|||
|
||||
std::unique_ptr<BlobReader> CreateBlobReader(const std::string& filename)
|
||||
{
|
||||
if (cdio_is_cdrom(filename))
|
||||
if (Common::cdio_is_cdrom(filename))
|
||||
return DriveReader::Create(filename);
|
||||
|
||||
File::IOFile file(filename, "rb");
|
||||
|
|
|
@ -166,7 +166,7 @@ void MenuBar::AddDVDBackupMenu(QMenu* file_menu)
|
|||
{
|
||||
m_backup_menu = file_menu->addMenu(tr("&Boot from DVD Backup"));
|
||||
|
||||
const std::vector<std::string> drives = cdio_get_devices();
|
||||
const std::vector<std::string> drives = Common::cdio_get_devices();
|
||||
// Windows Limitation of 24 character drives
|
||||
for (size_t i = 0; i < drives.size() && i < 24; i++)
|
||||
{
|
||||
|
|
|
@ -397,7 +397,7 @@ void GameListCtrl::RefreshList()
|
|||
if (SConfig::GetInstance().m_ListDrives)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(m_title_database_mutex);
|
||||
for (const auto& drive : cdio_get_devices())
|
||||
for (const auto& drive : Common::cdio_get_devices())
|
||||
{
|
||||
auto file = std::make_shared<UICommon::GameFile>(drive);
|
||||
if (file->IsValid())
|
||||
|
|
|
@ -72,7 +72,7 @@ wxMenu* MainMenuBar::CreateFileMenu() const
|
|||
{
|
||||
auto* const external_drive_menu = new wxMenu;
|
||||
|
||||
const std::vector<std::string> drives = cdio_get_devices();
|
||||
const std::vector<std::string> drives = Common::cdio_get_devices();
|
||||
// Windows Limitation of 24 character drives
|
||||
for (size_t i = 0; i < drives.size() && i < 24; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue