mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Remove usage of boost::filesystem.
This commit is contained in:
parent
6eca7d23fd
commit
7131a28fd4
48 changed files with 243 additions and 263 deletions
|
@ -23,7 +23,7 @@
|
|||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
static Framework::CStream* CreateImageStream(const boost::filesystem::path& imagePath)
|
||||
static Framework::CStream* CreateImageStream(const fs::path& imagePath)
|
||||
{
|
||||
auto imagePathString = imagePath.string();
|
||||
if(imagePathString.find("s3://") == 0)
|
||||
|
@ -48,7 +48,7 @@ static Framework::CStream* CreateImageStream(const boost::filesystem::path& imag
|
|||
#endif
|
||||
}
|
||||
|
||||
DiskUtils::OpticalMediaPtr DiskUtils::CreateOpticalMediaFromPath(const boost::filesystem::path& imagePath)
|
||||
DiskUtils::OpticalMediaPtr DiskUtils::CreateOpticalMediaFromPath(const fs::path& imagePath)
|
||||
{
|
||||
assert(!imagePath.empty());
|
||||
|
||||
|
@ -138,7 +138,7 @@ static std::string GetDiskIdFromPath(const std::string& filePath)
|
|||
return regionCode + "-" + serial1 + serial2;
|
||||
}
|
||||
|
||||
bool DiskUtils::TryGetDiskId(const boost::filesystem::path& imagePath, std::string* diskIdPtr)
|
||||
bool DiskUtils::TryGetDiskId(const fs::path& imagePath, std::string* diskIdPtr)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "OpticalMedia.h"
|
||||
|
||||
namespace DiskUtils
|
||||
|
@ -10,8 +10,8 @@ namespace DiskUtils
|
|||
typedef std::unique_ptr<COpticalMedia> OpticalMediaPtr;
|
||||
typedef std::map<std::string, std::string> SystemConfigMap;
|
||||
|
||||
OpticalMediaPtr CreateOpticalMediaFromPath(const boost::filesystem::path&);
|
||||
OpticalMediaPtr CreateOpticalMediaFromPath(const fs::path&);
|
||||
SystemConfigMap ParseSystemConfigFile(Framework::CStream*);
|
||||
|
||||
bool TryGetDiskId(const boost::filesystem::path&, std::string*);
|
||||
bool TryGetDiskId(const fs::path&, std::string*);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "StdStream.h"
|
||||
#include "Singleton.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@ private:
|
|||
|
||||
Framework::CStdStream& GetLog(const char*);
|
||||
|
||||
boost::filesystem::path m_logBasePath;
|
||||
fs::path m_logBasePath;
|
||||
LogMapType m_logs;
|
||||
bool m_showPrints = false;
|
||||
};
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
#define ONSCREEN_TICKS (FRAME_TICKS * 9 / 10)
|
||||
#define VBLANK_TICKS (FRAME_TICKS / 10)
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CPS2VM::CPS2VM()
|
||||
: m_nStatus(PAUSED)
|
||||
, m_nEnd(false)
|
||||
|
@ -77,7 +75,7 @@ CPS2VM::CPS2VM()
|
|||
CAppConfig::GetInstance().RegisterPreferencePath(setting, absolutePath);
|
||||
|
||||
auto currentPath = CAppConfig::GetInstance().GetPreferencePath(setting);
|
||||
if(!boost::filesystem::exists(currentPath))
|
||||
if(!fs::exists(currentPath))
|
||||
{
|
||||
CAppConfig::GetInstance().SetPreferencePath(setting, absolutePath);
|
||||
}
|
||||
|
@ -240,18 +238,18 @@ void CPS2VM::Destroy()
|
|||
DestroyVM();
|
||||
}
|
||||
|
||||
boost::filesystem::path CPS2VM::GetStateDirectoryPath()
|
||||
fs::path CPS2VM::GetStateDirectoryPath()
|
||||
{
|
||||
return CAppConfig::GetBasePath() / boost::filesystem::path("states/");
|
||||
return CAppConfig::GetBasePath() / fs::path("states/");
|
||||
}
|
||||
|
||||
boost::filesystem::path CPS2VM::GenerateStatePath(unsigned int slot) const
|
||||
fs::path CPS2VM::GenerateStatePath(unsigned int slot) const
|
||||
{
|
||||
auto stateFileName = string_format("%s.st%d.zip", m_ee->m_os->GetExecutableName(), slot);
|
||||
return GetStateDirectoryPath() / boost::filesystem::path(stateFileName);
|
||||
return GetStateDirectoryPath() / fs::path(stateFileName);
|
||||
}
|
||||
|
||||
std::future<bool> CPS2VM::SaveState(const filesystem::path& statePath)
|
||||
std::future<bool> CPS2VM::SaveState(const fs::path& statePath)
|
||||
{
|
||||
auto promise = std::make_shared<std::promise<bool>>();
|
||||
auto future = promise->get_future();
|
||||
|
@ -263,7 +261,7 @@ std::future<bool> CPS2VM::SaveState(const filesystem::path& statePath)
|
|||
return future;
|
||||
}
|
||||
|
||||
std::future<bool> CPS2VM::LoadState(const filesystem::path& statePath)
|
||||
std::future<bool> CPS2VM::LoadState(const fs::path& statePath)
|
||||
{
|
||||
auto promise = std::make_shared<std::promise<bool>>();
|
||||
auto future = promise->get_future();
|
||||
|
@ -306,7 +304,7 @@ CPS2VM::CPU_UTILISATION_INFO CPS2VM::GetCpuUtilisationInfo() const
|
|||
|
||||
std::string CPS2VM::MakeDebugTagsPackagePath(const char* packageName)
|
||||
{
|
||||
auto tagsPath = CAppConfig::GetBasePath() / boost::filesystem::path(TAGS_PATH);
|
||||
auto tagsPath = CAppConfig::GetBasePath() / fs::path(TAGS_PATH);
|
||||
Framework::PathUtils::EnsurePathExists(tagsPath);
|
||||
auto tagsPackagePath = tagsPath / (std::string(packageName) + std::string(".tags.xml"));
|
||||
return tagsPackagePath.string();
|
||||
|
@ -422,7 +420,7 @@ void CPS2VM::DestroyVM()
|
|||
CDROM0_Reset();
|
||||
}
|
||||
|
||||
bool CPS2VM::SaveVMState(const filesystem::path& statePath)
|
||||
bool CPS2VM::SaveVMState(const fs::path& statePath)
|
||||
{
|
||||
if(m_ee->m_gs == NULL)
|
||||
{
|
||||
|
@ -449,7 +447,7 @@ bool CPS2VM::SaveVMState(const filesystem::path& statePath)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CPS2VM::LoadVMState(const filesystem::path& statePath)
|
||||
bool CPS2VM::LoadVMState(const fs::path& statePath)
|
||||
{
|
||||
if(m_ee->m_gs == NULL)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <thread>
|
||||
#include <future>
|
||||
#include "boost_filesystem_def.h"
|
||||
#include "filesystem_def.h"
|
||||
#include "AppDef.h"
|
||||
#include "Types.h"
|
||||
#include "MIPS.h"
|
||||
|
@ -65,11 +65,11 @@ public:
|
|||
void DestroySoundHandler();
|
||||
void ReloadSpuBlockCount();
|
||||
|
||||
static boost::filesystem::path GetStateDirectoryPath();
|
||||
boost::filesystem::path GenerateStatePath(unsigned int) const;
|
||||
static fs::path GetStateDirectoryPath();
|
||||
fs::path GenerateStatePath(unsigned int) const;
|
||||
|
||||
std::future<bool> SaveState(const boost::filesystem::path&);
|
||||
std::future<bool> LoadState(const boost::filesystem::path&);
|
||||
std::future<bool> SaveState(const fs::path&);
|
||||
std::future<bool> LoadState(const fs::path&);
|
||||
|
||||
void TriggerFrameDump(const FrameDumpCallback&);
|
||||
|
||||
|
@ -94,8 +94,8 @@ private:
|
|||
void CreateVM();
|
||||
void ResetVM();
|
||||
void DestroyVM();
|
||||
bool SaveVMState(const boost::filesystem::path&);
|
||||
bool LoadVMState(const boost::filesystem::path&);
|
||||
bool SaveVMState(const fs::path&);
|
||||
bool LoadVMState(const fs::path&);
|
||||
|
||||
void ReloadExecutable(const char*, const CPS2OS::ArgumentList&);
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@ CScreenShotUtils::Connection CScreenShotUtils::TriggerGetScreenshot(CPS2VM* virt
|
|||
});
|
||||
}
|
||||
|
||||
boost::filesystem::path CScreenShotUtils::GetScreenShotDirectoryPath()
|
||||
fs::path CScreenShotUtils::GetScreenShotDirectoryPath()
|
||||
{
|
||||
auto screenshotpath(CAppConfig::GetBasePath() / boost::filesystem::path("screenshots"));
|
||||
auto screenshotpath(CAppConfig::GetBasePath() / fs::path("screenshots"));
|
||||
Framework::PathUtils::EnsurePathExists(screenshotpath);
|
||||
return screenshotpath;
|
||||
}
|
||||
|
||||
boost::filesystem::path CScreenShotUtils::GenerateScreenShotPath(const char* gameID)
|
||||
fs::path CScreenShotUtils::GenerateScreenShotPath(const char* gameID)
|
||||
{
|
||||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
|
@ -48,5 +48,5 @@ boost::filesystem::path CScreenShotUtils::GenerateScreenShotPath(const char* gam
|
|||
oss << gameID << std::put_time(&tm, "_%d-%m-%Y_%H.%M.%S.") << ms << ".bmp";
|
||||
auto screenshotFileName = oss.str();
|
||||
|
||||
return GetScreenShotDirectoryPath() / boost::filesystem::path(screenshotFileName);
|
||||
return GetScreenShotDirectoryPath() / fs::path(screenshotFileName);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ public:
|
|||
static Connection TriggerGetScreenshot(CPS2VM*, Callback);
|
||||
|
||||
private:
|
||||
static boost::filesystem::path GetScreenShotDirectoryPath();
|
||||
static boost::filesystem::path GenerateScreenShotPath(const char* gameID);
|
||||
static fs::path GetScreenShotDirectoryPath();
|
||||
static fs::path GenerateScreenShotPath(const char* gameID);
|
||||
};
|
||||
|
|
|
@ -327,7 +327,7 @@ void CPS2OS::DumpDmacHandlers()
|
|||
}
|
||||
}
|
||||
|
||||
void CPS2OS::BootFromFile(const boost::filesystem::path& execPath)
|
||||
void CPS2OS::BootFromFile(const fs::path& execPath)
|
||||
{
|
||||
auto stream = Framework::CreateInputStdStream(execPath.native());
|
||||
auto virtualExecutablePath = "host:" + execPath.filename().string();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "signal/Signal.h"
|
||||
#include "../ELF.h"
|
||||
#include "../MIPS.h"
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
void DumpIntcHandlers();
|
||||
void DumpDmacHandlers();
|
||||
|
||||
void BootFromFile(const boost::filesystem::path&);
|
||||
void BootFromFile(const fs::path&);
|
||||
void BootFromVirtualPath(const char*, const ArgumentList&);
|
||||
void BootFromCDROM();
|
||||
CELF* GetELF();
|
||||
|
|
|
@ -68,9 +68,9 @@ Directory CDirectoryDevice::GetDirectory(const char* devicePath)
|
|||
{
|
||||
auto basePath = CAppConfig::GetInstance().GetPreferencePath(m_basePathPreferenceName.c_str());
|
||||
auto path = basePath / devicePath;
|
||||
if(!boost::filesystem::is_directory(path))
|
||||
if(!fs::is_directory(path))
|
||||
{
|
||||
throw std::runtime_error("Not a directory.");
|
||||
}
|
||||
return boost::filesystem::directory_iterator(path);
|
||||
return fs::directory_iterator(path);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "Stream.h"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
namespace Ioman
|
||||
{
|
||||
typedef boost::filesystem::directory_iterator Directory;
|
||||
typedef fs::directory_iterator Directory;
|
||||
|
||||
class CDevice
|
||||
{
|
||||
|
|
|
@ -375,13 +375,13 @@ int32 CIoman::Dread(uint32 handle, Ioman::DIRENTRY* dirEntry)
|
|||
}
|
||||
|
||||
auto itemPath = directory->path();
|
||||
auto name = itemPath.leaf().string();
|
||||
auto name = itemPath.filename().string();
|
||||
strncpy(dirEntry->name, name.c_str(), Ioman::DIRENTRY::NAME_SIZE);
|
||||
dirEntry->name[Ioman::DIRENTRY::NAME_SIZE - 1] = 0;
|
||||
|
||||
auto& stat = dirEntry->stat;
|
||||
memset(&stat, 0, sizeof(Ioman::STAT));
|
||||
if(boost::filesystem::is_directory(itemPath))
|
||||
if(fs::is_directory(itemPath))
|
||||
{
|
||||
stat.mode = STAT_MODE_DIR;
|
||||
stat.attr = 0x8427;
|
||||
|
@ -389,7 +389,7 @@ int32 CIoman::Dread(uint32 handle, Ioman::DIRENTRY* dirEntry)
|
|||
else
|
||||
{
|
||||
stat.mode = STAT_MODE_FILE;
|
||||
stat.loSize = boost::filesystem::file_size(itemPath);
|
||||
stat.loSize = fs::file_size(itemPath);
|
||||
stat.attr = 0x8497;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "MIPSAssembler.h"
|
||||
|
||||
using namespace Iop;
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
#define CLUSTER_SIZE 0x400
|
||||
|
||||
|
@ -269,7 +268,7 @@ void CMcServ::Open(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, u
|
|||
return;
|
||||
}
|
||||
|
||||
filesystem::path filePath;
|
||||
fs::path filePath;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -288,7 +287,7 @@ void CMcServ::Open(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, u
|
|||
uint32 result = -1;
|
||||
try
|
||||
{
|
||||
filesystem::create_directory(filePath);
|
||||
fs::create_directory(filePath);
|
||||
result = 0;
|
||||
}
|
||||
catch(...)
|
||||
|
@ -301,7 +300,7 @@ void CMcServ::Open(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, u
|
|||
{
|
||||
if(cmd->flags & OPEN_FLAG_CREAT)
|
||||
{
|
||||
if(!boost::filesystem::exists(filePath))
|
||||
if(!fs::exists(filePath))
|
||||
{
|
||||
//Create file if it doesn't exist
|
||||
Framework::CreateOutputStdStream(filePath.native());
|
||||
|
@ -310,7 +309,7 @@ void CMcServ::Open(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, u
|
|||
|
||||
if(cmd->flags & OPEN_FLAG_TRUNC)
|
||||
{
|
||||
if(boost::filesystem::exists(filePath))
|
||||
if(fs::exists(filePath))
|
||||
{
|
||||
//Create file (discard contents) if it exists
|
||||
Framework::CreateOutputStdStream(filePath.native());
|
||||
|
@ -482,8 +481,8 @@ void CMcServ::ChDir(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize,
|
|||
|
||||
try
|
||||
{
|
||||
filesystem::path newCurrentDirectory;
|
||||
filesystem::path requestedDirectory(cmd->name);
|
||||
fs::path newCurrentDirectory;
|
||||
fs::path requestedDirectory(cmd->name);
|
||||
|
||||
if(!requestedDirectory.root_directory().empty())
|
||||
{
|
||||
|
@ -504,7 +503,7 @@ void CMcServ::ChDir(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize,
|
|||
auto mcPath = CAppConfig::GetInstance().GetPreferencePath(m_mcPathPreference[cmd->port]);
|
||||
mcPath /= newCurrentDirectory;
|
||||
|
||||
if(filesystem::exists(mcPath) && filesystem::is_directory(mcPath))
|
||||
if(fs::exists(mcPath) && fs::is_directory(mcPath))
|
||||
{
|
||||
m_currentDirectory = newCurrentDirectory;
|
||||
result = 0;
|
||||
|
@ -552,18 +551,18 @@ void CMcServ::GetDir(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize,
|
|||
{
|
||||
mcPath /= m_currentDirectory;
|
||||
}
|
||||
mcPath = filesystem::absolute(mcPath);
|
||||
mcPath = fs::absolute(mcPath);
|
||||
|
||||
if(!filesystem::exists(mcPath))
|
||||
if(!fs::exists(mcPath))
|
||||
{
|
||||
//Directory doesn't exist
|
||||
ret[0] = RET_NO_ENTRY;
|
||||
return;
|
||||
}
|
||||
|
||||
filesystem::path searchPath = mcPath / cmd->name;
|
||||
fs::path searchPath = mcPath / cmd->name;
|
||||
searchPath.remove_filename();
|
||||
if(!filesystem::exists(searchPath))
|
||||
if(!fs::exists(searchPath))
|
||||
{
|
||||
//Specified directory doesn't exist, this is an error
|
||||
ret[0] = RET_NO_ENTRY;
|
||||
|
@ -593,9 +592,9 @@ void CMcServ::Delete(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize,
|
|||
try
|
||||
{
|
||||
auto filePath = GetAbsoluteFilePath(cmd->port, cmd->slot, cmd->name);
|
||||
if(boost::filesystem::exists(filePath))
|
||||
if(fs::exists(filePath))
|
||||
{
|
||||
boost::filesystem::remove(filePath);
|
||||
fs::remove(filePath);
|
||||
ret[0] = 0;
|
||||
}
|
||||
else
|
||||
|
@ -622,7 +621,7 @@ void CMcServ::GetEntSpace(uint32* args, uint32 argsSize, uint32* ret, uint32 ret
|
|||
auto mcPath = CAppConfig::GetInstance().GetPreferencePath(m_mcPathPreference[cmd->port]);
|
||||
auto savePath = mcPath / cmd->name;
|
||||
|
||||
if(filesystem::exists(savePath) && filesystem::is_directory(savePath))
|
||||
if(fs::exists(savePath) && fs::is_directory(savePath))
|
||||
{
|
||||
// Arbitrarity number, allows Drakengard to detect MC
|
||||
ret[0] = 0xFE;
|
||||
|
@ -756,10 +755,10 @@ Framework::CStdStream* CMcServ::GetFileFromHandle(uint32 handle)
|
|||
return &file;
|
||||
}
|
||||
|
||||
boost::filesystem::path CMcServ::GetAbsoluteFilePath(unsigned int port, unsigned int slot, const char* name) const
|
||||
fs::path CMcServ::GetAbsoluteFilePath(unsigned int port, unsigned int slot, const char* name) const
|
||||
{
|
||||
auto mcPath = CAppConfig::GetInstance().GetPreferencePath(m_mcPathPreference[port]);
|
||||
auto requestedFilePath = boost::filesystem::path(name);
|
||||
auto requestedFilePath = fs::path(name);
|
||||
|
||||
if(!requestedFilePath.root_directory().empty())
|
||||
{
|
||||
|
@ -790,7 +789,7 @@ void CMcServ::CPathFinder::Reset()
|
|||
m_index = 0;
|
||||
}
|
||||
|
||||
void CMcServ::CPathFinder::Search(const boost::filesystem::path& basePath, const char* filter)
|
||||
void CMcServ::CPathFinder::Search(const fs::path& basePath, const char* filter)
|
||||
{
|
||||
m_basePath = basePath;
|
||||
|
||||
|
@ -809,7 +808,7 @@ void CMcServ::CPathFinder::Search(const boost::filesystem::path& basePath, const
|
|||
m_filterExp = std::regex(filterExpString);
|
||||
}
|
||||
|
||||
auto filterPath = boost::filesystem::path(filterPathString);
|
||||
auto filterPath = fs::path(filterPathString);
|
||||
filterPath.remove_filename();
|
||||
|
||||
auto currentDirPath = filterPath / ".";
|
||||
|
@ -856,15 +855,15 @@ unsigned int CMcServ::CPathFinder::Read(ENTRY* entry, unsigned int size)
|
|||
return readCount;
|
||||
}
|
||||
|
||||
void CMcServ::CPathFinder::SearchRecurse(const filesystem::path& path)
|
||||
void CMcServ::CPathFinder::SearchRecurse(const fs::path& path)
|
||||
{
|
||||
bool found = false;
|
||||
filesystem::directory_iterator endIterator;
|
||||
fs::directory_iterator endIterator;
|
||||
|
||||
for(filesystem::directory_iterator elementIterator(path);
|
||||
for(fs::directory_iterator elementIterator(path);
|
||||
elementIterator != endIterator; elementIterator++)
|
||||
{
|
||||
boost::filesystem::path relativePath(*elementIterator);
|
||||
fs::path relativePath(*elementIterator);
|
||||
std::string relativePathString(relativePath.generic_string());
|
||||
|
||||
//"Extract" a more appropriate relative path from the memory card point of view
|
||||
|
@ -880,21 +879,23 @@ void CMcServ::CPathFinder::SearchRecurse(const filesystem::path& path)
|
|||
strncpy(reinterpret_cast<char*>(entry.name), relativePath.filename().string().c_str(), 0x1F);
|
||||
entry.name[0x1F] = 0;
|
||||
|
||||
if(filesystem::is_directory(*elementIterator))
|
||||
if(fs::is_directory(*elementIterator))
|
||||
{
|
||||
entry.size = 0;
|
||||
entry.attributes = 0x8427;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.size = static_cast<uint32>(filesystem::file_size(*elementIterator));
|
||||
entry.size = static_cast<uint32>(fs::file_size(*elementIterator));
|
||||
entry.attributes = 0x8497;
|
||||
}
|
||||
|
||||
//Fill in modification date info
|
||||
{
|
||||
auto changeDate = filesystem::last_write_time(*elementIterator);
|
||||
auto localChangeDate = localtime(&changeDate);
|
||||
auto changeFileTime = fs::last_write_time(*elementIterator);
|
||||
auto changeSystemTime = std::chrono::system_clock::to_time_t(
|
||||
std::chrono::system_clock::now() + (changeFileTime - fs::file_time_type::clock::now()));
|
||||
auto localChangeDate = std::localtime(&changeSystemTime);
|
||||
|
||||
entry.modificationTime.second = localChangeDate->tm_sec;
|
||||
entry.modificationTime.minute = localChangeDate->tm_min;
|
||||
|
@ -904,14 +905,14 @@ void CMcServ::CPathFinder::SearchRecurse(const filesystem::path& path)
|
|||
entry.modificationTime.year = localChangeDate->tm_year + 1900;
|
||||
}
|
||||
|
||||
//boost::filesystem doesn't provide a way to get creation time, so just make it the same as modification date
|
||||
//std::filesystem doesn't provide a way to get creation time, so just make it the same as modification date
|
||||
entry.creationTime = entry.modificationTime;
|
||||
|
||||
m_entries.push_back(entry);
|
||||
found = true;
|
||||
}
|
||||
|
||||
if(filesystem::is_directory(*elementIterator) && !found)
|
||||
if(fs::is_directory(*elementIterator) && !found)
|
||||
{
|
||||
SearchRecurse(*elementIterator);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "StdStream.h"
|
||||
#include "Iop_Module.h"
|
||||
#include "Iop_SifMan.h"
|
||||
|
@ -125,16 +125,16 @@ namespace Iop
|
|||
virtual ~CPathFinder();
|
||||
|
||||
void Reset();
|
||||
void Search(const boost::filesystem::path&, const char*);
|
||||
void Search(const fs::path&, const char*);
|
||||
unsigned int Read(ENTRY*, unsigned int);
|
||||
|
||||
private:
|
||||
typedef std::vector<ENTRY> EntryList;
|
||||
|
||||
void SearchRecurse(const boost::filesystem::path&);
|
||||
void SearchRecurse(const fs::path&);
|
||||
|
||||
EntryList m_entries;
|
||||
boost::filesystem::path m_basePath;
|
||||
fs::path m_basePath;
|
||||
std::regex m_filterExp;
|
||||
unsigned int m_index;
|
||||
};
|
||||
|
@ -163,7 +163,7 @@ namespace Iop
|
|||
|
||||
uint32 GenerateHandle();
|
||||
Framework::CStdStream* GetFileFromHandle(uint32);
|
||||
boost::filesystem::path GetAbsoluteFilePath(unsigned int, unsigned int, const char*) const;
|
||||
fs::path GetAbsoluteFilePath(unsigned int, unsigned int, const char*) const;
|
||||
|
||||
CIopBios& m_bios;
|
||||
CSifMan& m_sifMan;
|
||||
|
@ -177,7 +177,7 @@ namespace Iop
|
|||
uint32 m_readFastAddr = 0;
|
||||
Framework::CStdStream m_files[MAX_FILES];
|
||||
static const char* m_mcPathPreference[2];
|
||||
boost::filesystem::path m_currentDirectory;
|
||||
fs::path m_currentDirectory;
|
||||
CPathFinder m_pathFinder;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ bool CS3ObjectStream::IsEOF()
|
|||
return (m_objectPosition == m_objectSize);
|
||||
}
|
||||
|
||||
boost::filesystem::path CS3ObjectStream::GetCachePath()
|
||||
fs::path CS3ObjectStream::GetCachePath()
|
||||
{
|
||||
return Framework::PathUtils::GetCachePath() / CACHE_PATH;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void CS3ObjectStream::SyncBuffer()
|
|||
[&]() {
|
||||
try
|
||||
{
|
||||
if(boost::filesystem::exists(readCacheFilePath))
|
||||
if(fs::exists(readCacheFilePath))
|
||||
{
|
||||
auto readCacheFileStream = Framework::CreateInputStdStream(readCacheFilePath.native());
|
||||
auto cacheRead = readCacheFileStream.Read(m_buffer.data(), size);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "Singleton.h"
|
||||
#include "Stream.h"
|
||||
#include "boost_filesystem_def.h"
|
||||
#include "filesystem_def.h"
|
||||
|
||||
class CS3ObjectStream : public Framework::CStream
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
bool IsEOF() override;
|
||||
|
||||
private:
|
||||
static boost::filesystem::path GetCachePath();
|
||||
static fs::path GetCachePath();
|
||||
std::string GenerateReadCacheKey(const std::pair<uint64, uint64>&) const;
|
||||
void GetObjectInfo();
|
||||
void SyncBuffer();
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#include "MemStream.h"
|
||||
#include "StdStreamUtils.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CMaxSaveImporter::CMaxSaveImporter()
|
||||
{
|
||||
}
|
||||
|
@ -15,7 +13,7 @@ CMaxSaveImporter::~CMaxSaveImporter()
|
|||
{
|
||||
}
|
||||
|
||||
void CMaxSaveImporter::Import(Framework::CStream& inputStream, const filesystem::path& basePath)
|
||||
void CMaxSaveImporter::Import(Framework::CStream& inputStream, const fs::path& basePath)
|
||||
{
|
||||
char magic[12];
|
||||
inputStream.Read(magic, sizeof(magic));
|
||||
|
@ -42,9 +40,9 @@ void CMaxSaveImporter::Import(Framework::CStream& inputStream, const filesystem:
|
|||
directoryDataStream.Seek(0, Framework::STREAM_SEEK_SET);
|
||||
|
||||
auto directoryPath = basePath / directoryName;
|
||||
if(!filesystem::exists(directoryPath))
|
||||
if(!fs::exists(directoryPath))
|
||||
{
|
||||
filesystem::create_directory(directoryPath);
|
||||
fs::create_directory(directoryPath);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < fileCount; i++)
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
CMaxSaveImporter();
|
||||
virtual ~CMaxSaveImporter();
|
||||
|
||||
virtual void Import(Framework::CStream&, const boost::filesystem::path&);
|
||||
void Import(Framework::CStream&, const fs::path&) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "MemoryCard.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CMemoryCard::CMemoryCard(const filesystem::path& basePath)
|
||||
CMemoryCard::CMemoryCard(const fs::path& basePath)
|
||||
: m_basePath(basePath)
|
||||
{
|
||||
ScanSaves();
|
||||
|
@ -18,7 +16,7 @@ const CSave* CMemoryCard::GetSaveByIndex(size_t index) const
|
|||
return m_saves[index].get();
|
||||
}
|
||||
|
||||
filesystem::path CMemoryCard::GetBasePath() const
|
||||
fs::path CMemoryCard::GetBasePath() const
|
||||
{
|
||||
return m_basePath;
|
||||
}
|
||||
|
@ -33,18 +31,18 @@ void CMemoryCard::ScanSaves()
|
|||
{
|
||||
try
|
||||
{
|
||||
filesystem::directory_iterator endIterator;
|
||||
for(filesystem::directory_iterator elementIterator(m_basePath);
|
||||
fs::directory_iterator endIterator;
|
||||
for(fs::directory_iterator elementIterator(m_basePath);
|
||||
elementIterator != endIterator; elementIterator++)
|
||||
{
|
||||
filesystem::path element(*elementIterator);
|
||||
fs::path element(*elementIterator);
|
||||
|
||||
if(filesystem::is_directory(element))
|
||||
if(fs::is_directory(element))
|
||||
{
|
||||
filesystem::path iconSysPath = element / "icon.sys";
|
||||
fs::path iconSysPath = element / "icon.sys";
|
||||
|
||||
//Check if 'icon.sys' exists in this directory
|
||||
if(filesystem::exists(iconSysPath))
|
||||
if(fs::exists(iconSysPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "Save.h"
|
||||
|
||||
class CMemoryCard
|
||||
|
@ -10,18 +10,18 @@ public:
|
|||
typedef std::shared_ptr<CSave> SavePtr;
|
||||
typedef std::vector<SavePtr> SaveList;
|
||||
|
||||
CMemoryCard(const boost::filesystem::path&);
|
||||
CMemoryCard(const fs::path&);
|
||||
virtual ~CMemoryCard() = default;
|
||||
|
||||
size_t GetSaveCount() const;
|
||||
const CSave* GetSaveByIndex(size_t) const;
|
||||
|
||||
boost::filesystem::path GetBasePath() const;
|
||||
fs::path GetBasePath() const;
|
||||
void RefreshContents();
|
||||
|
||||
private:
|
||||
void ScanSaves();
|
||||
|
||||
SaveList m_saves;
|
||||
boost::filesystem::path m_basePath;
|
||||
fs::path m_basePath;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "PsuSaveImporter.h"
|
||||
#include "StdStreamUtils.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CPsuSaveImporter::CPsuSaveImporter()
|
||||
{
|
||||
}
|
||||
|
@ -11,11 +9,11 @@ CPsuSaveImporter::~CPsuSaveImporter()
|
|||
{
|
||||
}
|
||||
|
||||
void CPsuSaveImporter::Import(Framework::CStream& input, const filesystem::path& basePath)
|
||||
void CPsuSaveImporter::Import(Framework::CStream& input, const fs::path& basePath)
|
||||
{
|
||||
if(!filesystem::exists(basePath))
|
||||
if(!fs::exists(basePath))
|
||||
{
|
||||
filesystem::create_directory(basePath);
|
||||
fs::create_directory(basePath);
|
||||
}
|
||||
|
||||
uint16 nEntryType = input.Read16();
|
||||
|
@ -43,7 +41,7 @@ void CPsuSaveImporter::Import(Framework::CStream& input, const filesystem::path&
|
|||
}
|
||||
else if(nEntryType == 0x8497)
|
||||
{
|
||||
filesystem::path outputPath = basePath / sEntryName;
|
||||
fs::path outputPath = basePath / sEntryName;
|
||||
if(!CanExtractFile(outputPath))
|
||||
{
|
||||
input.Seek(nEntrySize, Framework::STREAM_SEEK_CUR);
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
CPsuSaveImporter();
|
||||
virtual ~CPsuSaveImporter();
|
||||
|
||||
virtual void Import(Framework::CStream&, const boost::filesystem::path&);
|
||||
void Import(Framework::CStream&, const fs::path&) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
#include <boost/filesystem/operations.hpp>
|
||||
#include <exception>
|
||||
#include "string_cast_sjis.h"
|
||||
#include "Save.h"
|
||||
#include "StdStream.h"
|
||||
#include "StdStreamUtils.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CSave::CSave(const filesystem::path& basePath)
|
||||
CSave::CSave(const fs::path& basePath)
|
||||
: m_basePath(basePath)
|
||||
{
|
||||
filesystem::path iconSysPath = m_basePath / "icon.sys";
|
||||
auto iconSysPath = m_basePath / "icon.sys";
|
||||
|
||||
auto iconStream(Framework::CreateInputStdStream(iconSysPath.native()));
|
||||
|
||||
|
@ -39,7 +36,7 @@ CSave::CSave(const filesystem::path& basePath)
|
|||
|
||||
m_sId = m_basePath.filename().string();
|
||||
|
||||
m_nLastModificationTime = filesystem::last_write_time(iconSysPath);
|
||||
m_nLastModificationTime = std::chrono::time_point_cast<std::chrono::seconds>(fs::last_write_time(iconSysPath)).time_since_epoch().count();
|
||||
}
|
||||
|
||||
CSave::~CSave()
|
||||
|
@ -58,30 +55,30 @@ const char* CSave::GetId() const
|
|||
|
||||
unsigned int CSave::GetSize() const
|
||||
{
|
||||
filesystem::directory_iterator itEnd;
|
||||
fs::directory_iterator itEnd;
|
||||
unsigned int nSize = 0;
|
||||
|
||||
for(filesystem::directory_iterator itElement(m_basePath);
|
||||
for(fs::directory_iterator itElement(m_basePath);
|
||||
itElement != itEnd;
|
||||
itElement++)
|
||||
{
|
||||
if(!filesystem::is_directory(*itElement))
|
||||
if(!fs::is_directory(*itElement))
|
||||
{
|
||||
nSize += filesystem::file_size(*itElement);
|
||||
nSize += fs::file_size(*itElement);
|
||||
}
|
||||
}
|
||||
|
||||
return nSize;
|
||||
}
|
||||
|
||||
filesystem::path CSave::GetPath() const
|
||||
fs::path CSave::GetPath() const
|
||||
{
|
||||
return m_basePath;
|
||||
}
|
||||
|
||||
filesystem::path CSave::GetIconPath(const ICONTYPE& iconType) const
|
||||
fs::path CSave::GetIconPath(const ICONTYPE& iconType) const
|
||||
{
|
||||
filesystem::path iconPath;
|
||||
fs::path iconPath;
|
||||
switch(iconType)
|
||||
{
|
||||
case ICON_NORMAL:
|
||||
|
@ -97,17 +94,17 @@ filesystem::path CSave::GetIconPath(const ICONTYPE& iconType) const
|
|||
return iconPath;
|
||||
}
|
||||
|
||||
filesystem::path CSave::GetNormalIconPath() const
|
||||
fs::path CSave::GetNormalIconPath() const
|
||||
{
|
||||
return m_basePath / m_sNormalIconFileName;
|
||||
}
|
||||
|
||||
filesystem::path CSave::GetDeletingIconPath() const
|
||||
fs::path CSave::GetDeletingIconPath() const
|
||||
{
|
||||
return m_basePath / m_sDeletingIconFileName;
|
||||
}
|
||||
|
||||
filesystem::path CSave::GetCopyingIconPath() const
|
||||
fs::path CSave::GetCopyingIconPath() const
|
||||
{
|
||||
return m_basePath / m_sCopyingIconFileName;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _SAVE_H_
|
||||
#define _SAVE_H_
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include "Types.h"
|
||||
|
@ -17,18 +17,18 @@ public:
|
|||
ICON_COPYING,
|
||||
};
|
||||
|
||||
CSave(const boost::filesystem::path&);
|
||||
CSave(const fs::path&);
|
||||
virtual ~CSave();
|
||||
|
||||
const wchar_t* GetName() const;
|
||||
const char* GetId() const;
|
||||
unsigned int GetSize() const;
|
||||
|
||||
boost::filesystem::path GetPath() const;
|
||||
boost::filesystem::path GetIconPath(const ICONTYPE&) const;
|
||||
boost::filesystem::path GetNormalIconPath() const;
|
||||
boost::filesystem::path GetDeletingIconPath() const;
|
||||
boost::filesystem::path GetCopyingIconPath() const;
|
||||
fs::path GetPath() const;
|
||||
fs::path GetIconPath(const ICONTYPE&) const;
|
||||
fs::path GetNormalIconPath() const;
|
||||
fs::path GetDeletingIconPath() const;
|
||||
fs::path GetCopyingIconPath() const;
|
||||
|
||||
size_t GetSecondLineStartPosition() const;
|
||||
time_t GetLastModificationTime() const;
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
private:
|
||||
void ReadName(Framework::CStream&);
|
||||
|
||||
boost::filesystem::path m_basePath;
|
||||
fs::path m_basePath;
|
||||
std::wstring m_sName;
|
||||
std::string m_sId;
|
||||
std::string m_sNormalIconFileName;
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
#include <boost/filesystem/operations.hpp>
|
||||
#include <cstring>
|
||||
#include "SaveExporter.h"
|
||||
#include "StdStream.h"
|
||||
#include "StdStreamUtils.h"
|
||||
|
||||
void CSaveExporter::ExportPSU(Framework::CStream& outputStream, const boost::filesystem::path& savePath)
|
||||
void CSaveExporter::ExportPSU(Framework::CStream& outputStream, const fs::path& savePath)
|
||||
{
|
||||
uint32 nSector = 0x18D;
|
||||
|
||||
boost::posix_time::ptime baseTime =
|
||||
boost::posix_time::from_time_t(boost::filesystem::last_write_time(savePath));
|
||||
auto baseTime = fs::last_write_time(savePath);
|
||||
|
||||
//Save base directory entry
|
||||
{
|
||||
|
@ -18,12 +16,12 @@ void CSaveExporter::ExportPSU(Framework::CStream& outputStream, const boost::fil
|
|||
|
||||
Entry.nSize = 2;
|
||||
|
||||
const boost::filesystem::directory_iterator itEnd;
|
||||
for(boost::filesystem::directory_iterator itElement(savePath);
|
||||
const fs::directory_iterator itEnd;
|
||||
for(fs::directory_iterator itElement(savePath);
|
||||
itElement != itEnd;
|
||||
itElement++)
|
||||
{
|
||||
if(boost::filesystem::is_directory(*itElement)) continue;
|
||||
if(fs::is_directory(*itElement)) continue;
|
||||
Entry.nSize++;
|
||||
}
|
||||
|
||||
|
@ -64,23 +62,22 @@ void CSaveExporter::ExportPSU(Framework::CStream& outputStream, const boost::fil
|
|||
nSector += 2;
|
||||
|
||||
//Save individual file entries
|
||||
const boost::filesystem::directory_iterator itEnd;
|
||||
for(boost::filesystem::directory_iterator itElement(savePath);
|
||||
const fs::directory_iterator itEnd;
|
||||
for(fs::directory_iterator itElement(savePath);
|
||||
itElement != itEnd;
|
||||
itElement++)
|
||||
{
|
||||
if(boost::filesystem::is_directory(*itElement)) continue;
|
||||
if(fs::is_directory(*itElement)) continue;
|
||||
|
||||
boost::filesystem::path saveItemPath(*itElement);
|
||||
fs::path saveItemPath(*itElement);
|
||||
|
||||
boost::posix_time::ptime itemTime =
|
||||
boost::posix_time::from_time_t(boost::filesystem::last_write_time(saveItemPath));
|
||||
auto itemTime = fs::last_write_time(saveItemPath);
|
||||
|
||||
PSUENTRY Entry;
|
||||
memset(&Entry, 0, sizeof(PSUENTRY));
|
||||
|
||||
Entry.nFlags = 0x8497;
|
||||
Entry.nSize = static_cast<uint32>(boost::filesystem::file_size(saveItemPath));
|
||||
Entry.nSize = static_cast<uint32>(fs::file_size(saveItemPath));
|
||||
Entry.nSector = nSector;
|
||||
|
||||
PSU_CopyTime(&Entry.CreationTime, itemTime);
|
||||
|
@ -121,12 +118,15 @@ void CSaveExporter::ExportPSU(Framework::CStream& outputStream, const boost::fil
|
|||
}
|
||||
}
|
||||
|
||||
void CSaveExporter::PSU_CopyTime(PSUENTRY::TIME* pDst, const boost::posix_time::ptime& pSrc)
|
||||
void CSaveExporter::PSU_CopyTime(PSUENTRY::TIME* pDst, const fs::file_time_type& fileTime)
|
||||
{
|
||||
pDst->nSecond = static_cast<uint8>(pSrc.time_of_day().seconds());
|
||||
pDst->nMinute = static_cast<uint8>(pSrc.time_of_day().minutes());
|
||||
pDst->nHour = static_cast<uint8>(pSrc.time_of_day().hours());
|
||||
pDst->nDay = static_cast<uint8>(pSrc.date().day());
|
||||
pDst->nMonth = static_cast<uint8>(pSrc.date().month());
|
||||
pDst->nYear = pSrc.date().year();
|
||||
auto systemTime = std::chrono::system_clock::now() + (fileTime - fs::file_time_type::clock::now());
|
||||
auto tm = std::chrono::system_clock::to_time_t(systemTime);
|
||||
const auto pSrc = std::localtime(&tm);
|
||||
pDst->nSecond = static_cast<uint8>(pSrc->tm_sec);
|
||||
pDst->nMinute = static_cast<uint8>(pSrc->tm_min);
|
||||
pDst->nHour = static_cast<uint8>(pSrc->tm_hour);
|
||||
pDst->nDay = static_cast<uint8>(pSrc->tm_mday);
|
||||
pDst->nMonth = static_cast<uint8>(pSrc->tm_mon);
|
||||
pDst->nYear = pSrc->tm_year;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
#ifndef _SAVEEXPORTER_H_
|
||||
#define _SAVEEXPORTER_H_
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "Types.h"
|
||||
#include "Stream.h"
|
||||
|
||||
class CSaveExporter
|
||||
{
|
||||
public:
|
||||
static void ExportPSU(Framework::CStream&, const boost::filesystem::path&);
|
||||
static void ExportPSU(Framework::CStream&, const fs::path&);
|
||||
|
||||
private:
|
||||
#pragma pack(push, 1)
|
||||
|
@ -40,7 +39,7 @@ private:
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
static void PSU_CopyTime(PSUENTRY::TIME*, const boost::posix_time::ptime&);
|
||||
static void PSU_CopyTime(PSUENTRY::TIME*, const fs::file_time_type&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include "SaveImporter.h"
|
||||
#include "StdStreamUtils.h"
|
||||
#include "PsuSaveImporter.h"
|
||||
#include "XpsSaveImporter.h"
|
||||
#include "MaxSaveImporter.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
void CSaveImporter::ImportSave(Framework::CStream& input, const boost::filesystem::path& outputPath, const OverwritePromptHandlerType& overwritePromptHandler)
|
||||
void CSaveImporter::ImportSave(Framework::CStream& input, const fs::path& outputPath, const OverwritePromptHandlerType& overwritePromptHandler)
|
||||
{
|
||||
std::shared_ptr<CSaveImporterBase> importer;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _SAVEIMPORTER_H_
|
||||
#define _SAVEIMPORTER_H_
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "Stream.h"
|
||||
#include "SaveImporterBase.h"
|
||||
|
||||
|
@ -10,7 +10,7 @@ class CSaveImporter
|
|||
public:
|
||||
typedef CSaveImporterBase::OverwritePromptHandlerType OverwritePromptHandlerType;
|
||||
|
||||
static void ImportSave(Framework::CStream&, const boost::filesystem::path&, const OverwritePromptHandlerType&);
|
||||
static void ImportSave(Framework::CStream&, const fs::path&, const OverwritePromptHandlerType&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "SaveImporterBase.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CSaveImporterBase::CSaveImporterBase()
|
||||
: m_overwriteAll(false)
|
||||
{
|
||||
|
@ -16,13 +14,13 @@ void CSaveImporterBase::SetOverwritePromptHandler(const OverwritePromptHandlerTy
|
|||
m_overwritePromptHandler = overwritePromptHandler;
|
||||
}
|
||||
|
||||
bool CSaveImporterBase::CanExtractFile(const filesystem::path& filePath)
|
||||
bool CSaveImporterBase::CanExtractFile(const fs::path& filePath)
|
||||
{
|
||||
if(!filesystem::exists(filePath)) return true;
|
||||
if(!fs::exists(filePath)) return true;
|
||||
if(m_overwriteAll) return true;
|
||||
if(!m_overwritePromptHandler) return true;
|
||||
|
||||
auto result = m_overwritePromptHandler(filesystem::absolute(filePath).string());
|
||||
auto result = m_overwritePromptHandler(fs::absolute(filePath).string());
|
||||
|
||||
switch(result)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _SAVEIMPORTERBASE_H_
|
||||
#define _SAVEIMPORTERBASE_H_
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include <functional>
|
||||
#include "Stream.h"
|
||||
|
||||
|
@ -15,17 +15,17 @@ public:
|
|||
OVERWRITE_NO
|
||||
};
|
||||
|
||||
typedef std::function<OVERWRITE_PROMPT_RETURN(const boost::filesystem::path&)> OverwritePromptHandlerType;
|
||||
typedef std::function<OVERWRITE_PROMPT_RETURN(const fs::path&)> OverwritePromptHandlerType;
|
||||
|
||||
CSaveImporterBase();
|
||||
virtual ~CSaveImporterBase();
|
||||
|
||||
virtual void Import(Framework::CStream&, const boost::filesystem::path&) = 0;
|
||||
virtual void Import(Framework::CStream&, const fs::path&) = 0;
|
||||
|
||||
void SetOverwritePromptHandler(const OverwritePromptHandlerType&);
|
||||
|
||||
protected:
|
||||
bool CanExtractFile(const boost::filesystem::path&);
|
||||
bool CanExtractFile(const fs::path&);
|
||||
|
||||
private:
|
||||
bool m_overwriteAll;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#include "XpsSaveImporter.h"
|
||||
#include "StdStreamUtils.h"
|
||||
|
||||
namespace filesystem = boost::filesystem;
|
||||
|
||||
CXpsSaveImporter::CXpsSaveImporter()
|
||||
{
|
||||
}
|
||||
|
@ -12,7 +10,7 @@ CXpsSaveImporter::~CXpsSaveImporter()
|
|||
{
|
||||
}
|
||||
|
||||
void CXpsSaveImporter::Import(Framework::CStream& input, const boost::filesystem::path& outputPath)
|
||||
void CXpsSaveImporter::Import(Framework::CStream& input, const fs::path& outputPath)
|
||||
{
|
||||
input.Seek(4, Framework::STREAM_SEEK_SET);
|
||||
|
||||
|
@ -53,11 +51,11 @@ void CXpsSaveImporter::Import(Framework::CStream& input, const boost::filesystem
|
|||
ExtractFiles(input, outputPath, nArchiveSize);
|
||||
}
|
||||
|
||||
void CXpsSaveImporter::ExtractFiles(Framework::CStream& input, const boost::filesystem::path& basePath, uint32 nArchiveSize)
|
||||
void CXpsSaveImporter::ExtractFiles(Framework::CStream& input, const fs::path& basePath, uint32 nArchiveSize)
|
||||
{
|
||||
if(!filesystem::exists(basePath))
|
||||
if(!fs::exists(basePath))
|
||||
{
|
||||
filesystem::create_directory(basePath);
|
||||
fs::create_directory(basePath);
|
||||
}
|
||||
|
||||
while(!input.IsEOF() && (static_cast<uint32>(input.Tell()) < nArchiveSize))
|
||||
|
@ -74,7 +72,7 @@ void CXpsSaveImporter::ExtractFiles(Framework::CStream& input, const boost::file
|
|||
|
||||
input.Seek(nDescriptorLength - (0x40 + 4 + 4 + 8 + 2), Framework::STREAM_SEEK_CUR);
|
||||
|
||||
filesystem::path outputPath(basePath / sName);
|
||||
fs::path outputPath(basePath / sName);
|
||||
|
||||
if(nAttributes & 0x2000)
|
||||
{
|
||||
|
|
|
@ -9,10 +9,10 @@ public:
|
|||
CXpsSaveImporter();
|
||||
virtual ~CXpsSaveImporter();
|
||||
|
||||
virtual void Import(Framework::CStream&, const boost::filesystem::path&);
|
||||
void Import(Framework::CStream&, const fs::path&) override;
|
||||
|
||||
private:
|
||||
void ExtractFiles(Framework::CStream&, const boost::filesystem::path&, uint32);
|
||||
void ExtractFiles(Framework::CStream&, const fs::path&, uint32);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,12 +27,13 @@ void CoverUtils::PopulatePlaceholderCover()
|
|||
CoverUtils::cache.insert(std::make_pair("PH", pixmap));
|
||||
}
|
||||
}
|
||||
|
||||
void CoverUtils::PopulateCache(std::vector<BootablesDb::Bootable> bootables)
|
||||
{
|
||||
m_lock.lock();
|
||||
PopulatePlaceholderCover();
|
||||
|
||||
auto coverpath(CAppConfig::GetBasePath() / boost::filesystem::path("covers"));
|
||||
auto coverpath(CAppConfig::GetBasePath() / fs::path("covers"));
|
||||
Framework::PathUtils::EnsurePathExists(coverpath);
|
||||
|
||||
auto itr = CoverUtils::cache.find("PH");
|
||||
|
@ -43,7 +44,7 @@ void CoverUtils::PopulateCache(std::vector<BootablesDb::Bootable> bootables)
|
|||
continue;
|
||||
|
||||
auto path = coverpath / (bootable.discId + ".jpg");
|
||||
if(boost::filesystem::exists(path))
|
||||
if(fs::exists(path))
|
||||
{
|
||||
auto itr = CoverUtils::cache.find(bootable.discId.c_str());
|
||||
if(itr == CoverUtils::cache.end())
|
||||
|
|
|
@ -31,14 +31,14 @@ QString CvtToString(const std::wstring& str)
|
|||
return QString::fromStdWString(str);
|
||||
}
|
||||
|
||||
boost::filesystem::path QStringToPath(const QString& str)
|
||||
fs::path QStringToPath(const QString& str)
|
||||
{
|
||||
auto nativeStr = QDir::toNativeSeparators(str);
|
||||
auto result = CvtToNativePath<boost::filesystem::path::string_type>(nativeStr);
|
||||
return boost::filesystem::path(result);
|
||||
auto result = CvtToNativePath<fs::path::string_type>(nativeStr);
|
||||
return fs::path(result);
|
||||
}
|
||||
|
||||
QString PathToQString(const boost::filesystem::path& path)
|
||||
QString PathToQString(const fs::path& path)
|
||||
{
|
||||
return CvtToString(path.native());
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include "boost_filesystem_def.h"
|
||||
#include "filesystem_def.h"
|
||||
|
||||
boost::filesystem::path QStringToPath(const QString&);
|
||||
QString PathToQString(const boost::filesystem::path&);
|
||||
fs::path QStringToPath(const QString&);
|
||||
QString PathToQString(const fs::path&);
|
||||
|
|
|
@ -37,7 +37,7 @@ bool S3FileBrowser::IsAvailable()
|
|||
return !accessKeyId.empty() && !accessKeySecret.empty();
|
||||
}
|
||||
|
||||
boost::filesystem::path S3FileBrowser::GetSelectedPath() const
|
||||
fs::path S3FileBrowser::GetSelectedPath() const
|
||||
{
|
||||
return m_selectedPath;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <QListWidgetItem>
|
||||
#undef DELETE
|
||||
#include "../s3stream/AmazonS3Client.h"
|
||||
#include "boost_filesystem_def.h"
|
||||
#include "filesystem_def.h"
|
||||
#include "ContinuationChecker.h"
|
||||
|
||||
namespace Ui
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
static bool IsAvailable();
|
||||
|
||||
boost::filesystem::path GetSelectedPath() const;
|
||||
fs::path GetSelectedPath() const;
|
||||
|
||||
private slots:
|
||||
void refreshButton_clicked();
|
||||
|
@ -41,5 +41,5 @@ private:
|
|||
QTimer* m_filterTimer = nullptr;
|
||||
|
||||
ListObjectsResult m_bucketItems;
|
||||
boost::filesystem::path m_selectedPath;
|
||||
fs::path m_selectedPath;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <map>
|
||||
#include "boost_filesystem_def.h"
|
||||
#include "filesystem_def.h"
|
||||
|
||||
class CDevice
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
private:
|
||||
const char* m_name;
|
||||
const char* m_preference;
|
||||
boost::filesystem::path m_value;
|
||||
fs::path m_value;
|
||||
};
|
||||
|
||||
class CCdrom0Device : public CDevice
|
||||
|
@ -53,6 +53,6 @@ public:
|
|||
void Save() override;
|
||||
|
||||
private:
|
||||
boost::filesystem::path m_imagePath;
|
||||
fs::path m_imagePath;
|
||||
BINDINGTYPE m_bindingType;
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
|
||||
m_pauseFocusLost = CAppConfig::GetInstance().GetPreferenceBoolean(PREF_UI_PAUSEWHENFOCUSLOST);
|
||||
auto lastPath = CAppConfig::GetInstance().GetPreferencePath(PREF_PS2_CDROM0_PATH);
|
||||
if(boost::filesystem::exists(lastPath))
|
||||
if(fs::exists(lastPath))
|
||||
{
|
||||
m_lastPath = lastPath.parent_path();
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ void MainWindow::on_actionBoot_ELF_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::BootElf(boost::filesystem::path filePath)
|
||||
void MainWindow::BootElf(fs::path filePath)
|
||||
{
|
||||
BootablesDb::CClient::GetInstance().SetLastBootedTime(filePath, std::time(nullptr));
|
||||
|
||||
|
@ -353,7 +353,7 @@ void MainWindow::BootElf(boost::filesystem::path filePath)
|
|||
.arg(m_virtualMachine->m_ee->m_os->GetExecutableName()));
|
||||
}
|
||||
|
||||
void MainWindow::LoadCDROM(boost::filesystem::path filePath)
|
||||
void MainWindow::LoadCDROM(fs::path filePath)
|
||||
{
|
||||
m_lastPath = filePath.parent_path();
|
||||
CAppConfig::GetInstance().SetPreferencePath(PREF_PS2_CDROM0_PATH, filePath);
|
||||
|
@ -688,9 +688,9 @@ void MainWindow::ShowFrameDebugger()
|
|||
SetForegroundWindow(*m_frameDebugger);
|
||||
}
|
||||
|
||||
boost::filesystem::path MainWindow::GetFrameDumpDirectoryPath()
|
||||
fs::path MainWindow::GetFrameDumpDirectoryPath()
|
||||
{
|
||||
return CAppConfig::GetBasePath() / boost::filesystem::path("framedumps/");
|
||||
return CAppConfig::GetBasePath() / fs::path("framedumps/");
|
||||
}
|
||||
|
||||
void MainWindow::DumpNextFrame()
|
||||
|
@ -704,8 +704,8 @@ void MainWindow::DumpNextFrame()
|
|||
for(unsigned int i = 0; i < UINT_MAX; i++)
|
||||
{
|
||||
auto frameDumpFileName = string_format("framedump_%08d.dmp.zip", i);
|
||||
auto frameDumpPath = frameDumpDirectoryPath / boost::filesystem::path(frameDumpFileName);
|
||||
if(!boost::filesystem::exists(frameDumpPath))
|
||||
auto frameDumpPath = frameDumpDirectoryPath / fs::path(frameDumpFileName);
|
||||
if(!fs::exists(frameDumpPath))
|
||||
{
|
||||
auto dumpStream = Framework::CreateOutputStdStream(frameDumpPath.native());
|
||||
frameDump.Write(dumpStream);
|
||||
|
|
|
@ -42,15 +42,15 @@ public:
|
|||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
void BootElf(boost::filesystem::path);
|
||||
void BootElf(fs::path);
|
||||
void BootCDROM();
|
||||
void LoadCDROM(boost::filesystem::path filePath);
|
||||
void LoadCDROM(fs::path filePath);
|
||||
void loadState(int);
|
||||
|
||||
#ifdef DEBUGGER_INCLUDED
|
||||
void ShowDebugger();
|
||||
void ShowFrameDebugger();
|
||||
boost::filesystem::path GetFrameDumpDirectoryPath();
|
||||
fs::path GetFrameDumpDirectoryPath();
|
||||
void DumpNextFrame();
|
||||
void ToggleGsDraw();
|
||||
#endif
|
||||
|
@ -65,13 +65,13 @@ private:
|
|||
struct LastOpenCommand
|
||||
{
|
||||
LastOpenCommand() = default;
|
||||
LastOpenCommand(BootType type, boost::filesystem::path path)
|
||||
LastOpenCommand(BootType type, fs::path path)
|
||||
: type(type)
|
||||
, path(path)
|
||||
{
|
||||
}
|
||||
BootType type = BootType::CD;
|
||||
boost::filesystem::path path;
|
||||
fs::path path;
|
||||
};
|
||||
|
||||
void SetOpenGlPanelSize();
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
bool m_pauseFocusLost = true;
|
||||
std::shared_ptr<CInputProviderQtKey> m_qtKeyInputProvider;
|
||||
LastOpenCommand m_lastOpenCommand;
|
||||
boost::filesystem::path m_lastPath;
|
||||
fs::path m_lastPath;
|
||||
|
||||
Framework::CSignal<void()>::Connection m_OnExecutableChangeConnection;
|
||||
CGSHandler::NewFrameEvent::Connection m_OnNewFrameConnection;
|
||||
|
|
|
@ -64,9 +64,9 @@ void MemoryCardManagerDialog::on_import_saves_button_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
CSaveImporterBase::OVERWRITE_PROMPT_RETURN MemoryCardManagerDialog::OnImportOverwrite(const boost::filesystem::path& filePath)
|
||||
CSaveImporterBase::OVERWRITE_PROMPT_RETURN MemoryCardManagerDialog::OnImportOverwrite(const fs::path& filePath)
|
||||
{
|
||||
std::string fileName = filePath.leaf().string();
|
||||
std::string fileName = filePath.filename().string();
|
||||
QString msg("File %1 already exists.\n\nOverwrite?");
|
||||
QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Overwrite?",
|
||||
msg.arg(fileName.c_str()),
|
||||
|
@ -136,7 +136,7 @@ void MemoryCardManagerDialog::on_delete_save_button_clicked()
|
|||
if(currentRow >= 0 && currentRow <= nItemCount)
|
||||
{
|
||||
const CSave* save = m_pCurrentMemoryCard->GetSaveByIndex(currentRow);
|
||||
boost::filesystem::remove_all(save->GetPath());
|
||||
fs::remove_all(save->GetPath());
|
||||
m_pCurrentMemoryCard->RefreshContents();
|
||||
populateSaveList();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "saves/SaveImporter.h"
|
||||
#include <QDialog>
|
||||
#include <QDir>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -22,7 +21,7 @@ public:
|
|||
~MemoryCardManagerDialog();
|
||||
|
||||
private:
|
||||
CSaveImporterBase::OVERWRITE_PROMPT_RETURN OnImportOverwrite(const boost::filesystem::path&);
|
||||
CSaveImporterBase::OVERWRITE_PROMPT_RETURN OnImportOverwrite(const fs::path&);
|
||||
void populateSaveList();
|
||||
|
||||
Ui::MemoryCardManagerDialog* ui;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <QMessageBox>
|
||||
#include "QStringUtils.h"
|
||||
|
||||
VFSDiscSelectorDialog::VFSDiscSelectorDialog(boost::filesystem::path path, CCdrom0Device::BINDINGTYPE m_nBindingType, QWidget* parent)
|
||||
VFSDiscSelectorDialog::VFSDiscSelectorDialog(fs::path path, CCdrom0Device::BINDINGTYPE m_nBindingType, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::VFSDiscSelectorDialog)
|
||||
, m_path(path)
|
||||
|
|
|
@ -15,7 +15,7 @@ class VFSDiscSelectorDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VFSDiscSelectorDialog(boost::filesystem::path, CCdrom0Device::BINDINGTYPE, QWidget* parent = nullptr);
|
||||
explicit VFSDiscSelectorDialog(fs::path, CCdrom0Device::BINDINGTYPE, QWidget* parent = nullptr);
|
||||
~VFSDiscSelectorDialog();
|
||||
|
||||
protected:
|
||||
|
@ -35,6 +35,6 @@ private:
|
|||
void Refresh_disc_drive();
|
||||
|
||||
Ui::VFSDiscSelectorDialog* ui;
|
||||
boost::filesystem::path m_path;
|
||||
fs::path m_path;
|
||||
QList<QStorageInfo> m_discInfo;
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@ CClient::CClient()
|
|||
}
|
||||
}
|
||||
|
||||
Bootable CClient::GetBootable(const boost::filesystem::path& path)
|
||||
Bootable CClient::GetBootable(const fs::path& path)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "SELECT * FROM bootables WHERE path = ?");
|
||||
statement.BindText(1, Framework::PathUtils::GetNativeStringFromPath(path).c_str());
|
||||
|
@ -78,7 +78,7 @@ std::vector<Bootable> CClient::GetBootables(int32_t sortMethod)
|
|||
return bootables;
|
||||
}
|
||||
|
||||
void CClient::RegisterBootable(const boost::filesystem::path& path, const char* title, const char* discId)
|
||||
void CClient::RegisterBootable(const fs::path& path, const char* title, const char* discId)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "INSERT OR IGNORE INTO bootables (path, title, discId) VALUES (?,?,?)");
|
||||
statement.BindText(1, Framework::PathUtils::GetNativeStringFromPath(path).c_str());
|
||||
|
@ -87,14 +87,14 @@ void CClient::RegisterBootable(const boost::filesystem::path& path, const char*
|
|||
statement.StepNoResult();
|
||||
}
|
||||
|
||||
void CClient::UnregisterBootable(const boost::filesystem::path& path)
|
||||
void CClient::UnregisterBootable(const fs::path& path)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "DELETE FROM bootables WHERE path = ?");
|
||||
statement.BindText(1, Framework::PathUtils::GetNativeStringFromPath(path).c_str());
|
||||
statement.StepNoResult();
|
||||
}
|
||||
|
||||
void CClient::SetDiscId(const boost::filesystem::path& path, const char* discId)
|
||||
void CClient::SetDiscId(const fs::path& path, const char* discId)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "UPDATE bootables SET discId = ? WHERE path = ?");
|
||||
statement.BindText(1, discId, true);
|
||||
|
@ -102,7 +102,7 @@ void CClient::SetDiscId(const boost::filesystem::path& path, const char* discId)
|
|||
statement.StepNoResult();
|
||||
}
|
||||
|
||||
void CClient::SetTitle(const boost::filesystem::path& path, const char* title)
|
||||
void CClient::SetTitle(const fs::path& path, const char* title)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "UPDATE bootables SET title = ? WHERE path = ?");
|
||||
statement.BindText(1, title, true);
|
||||
|
@ -110,7 +110,7 @@ void CClient::SetTitle(const boost::filesystem::path& path, const char* title)
|
|||
statement.StepNoResult();
|
||||
}
|
||||
|
||||
void CClient::SetCoverUrl(const boost::filesystem::path& path, const char* coverUrl)
|
||||
void CClient::SetCoverUrl(const fs::path& path, const char* coverUrl)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "UPDATE bootables SET coverUrl = ? WHERE path = ?");
|
||||
statement.BindText(1, coverUrl, true);
|
||||
|
@ -118,7 +118,7 @@ void CClient::SetCoverUrl(const boost::filesystem::path& path, const char* cover
|
|||
statement.StepNoResult();
|
||||
}
|
||||
|
||||
void CClient::SetLastBootedTime(const boost::filesystem::path& path, time_t lastBootedTime)
|
||||
void CClient::SetLastBootedTime(const fs::path& path, time_t lastBootedTime)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "UPDATE bootables SET lastBootedTime = ? WHERE path = ?");
|
||||
statement.BindInteger(1, lastBootedTime);
|
||||
|
@ -126,7 +126,7 @@ void CClient::SetLastBootedTime(const boost::filesystem::path& path, time_t last
|
|||
statement.StepNoResult();
|
||||
}
|
||||
|
||||
void CClient::SetOverview(const boost::filesystem::path& path, const char* overview)
|
||||
void CClient::SetOverview(const fs::path& path, const char* overview)
|
||||
{
|
||||
Framework::CSqliteStatement statement(m_db, "UPDATE bootables SET overview = ? WHERE path = ?");
|
||||
statement.BindText(1, overview, true);
|
||||
|
@ -168,6 +168,6 @@ void CClient::CheckDbVersion()
|
|||
|
||||
if(!dbExistsAndMatchesVersion)
|
||||
{
|
||||
boost::filesystem::remove(m_dbPath);
|
||||
fs::remove(m_dbPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include "Types.h"
|
||||
#include "Singleton.h"
|
||||
#include "sqlite/SqliteDb.h"
|
||||
|
@ -11,7 +11,7 @@ namespace BootablesDb
|
|||
{
|
||||
struct Bootable
|
||||
{
|
||||
boost::filesystem::path path;
|
||||
fs::path path;
|
||||
std::string discId;
|
||||
std::string title;
|
||||
std::string coverUrl;
|
||||
|
@ -33,24 +33,24 @@ namespace BootablesDb
|
|||
CClient();
|
||||
virtual ~CClient() = default;
|
||||
|
||||
Bootable GetBootable(const boost::filesystem::path&);
|
||||
Bootable GetBootable(const fs::path&);
|
||||
std::vector<Bootable> GetBootables(int32_t = SORT_METHOD_NONE);
|
||||
|
||||
void RegisterBootable(const boost::filesystem::path&, const char*, const char*);
|
||||
void UnregisterBootable(const boost::filesystem::path&);
|
||||
void RegisterBootable(const fs::path&, const char*, const char*);
|
||||
void UnregisterBootable(const fs::path&);
|
||||
|
||||
void SetDiscId(const boost::filesystem::path&, const char*);
|
||||
void SetTitle(const boost::filesystem::path&, const char*);
|
||||
void SetCoverUrl(const boost::filesystem::path&, const char*);
|
||||
void SetLastBootedTime(const boost::filesystem::path&, time_t);
|
||||
void SetOverview(const boost::filesystem::path& path, const char* overview);
|
||||
void SetDiscId(const fs::path&, const char*);
|
||||
void SetTitle(const fs::path&, const char*);
|
||||
void SetCoverUrl(const fs::path&, const char*);
|
||||
void SetLastBootedTime(const fs::path&, time_t);
|
||||
void SetOverview(const fs::path& path, const char* overview);
|
||||
|
||||
private:
|
||||
static Bootable ReadBootable(Framework::CSqliteStatement&);
|
||||
|
||||
void CheckDbVersion();
|
||||
|
||||
boost::filesystem::path m_dbPath;
|
||||
fs::path m_dbPath;
|
||||
Framework::CSqliteDb m_db;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include "DiskUtils.h"
|
||||
#include "PathUtils.h"
|
||||
#include "string_format.h"
|
||||
#include "StdStreamUtils.h"
|
||||
#include "http/HttpClientFactory.h"
|
||||
#include <iostream>
|
||||
|
||||
//Jobs
|
||||
// Scan for new games (from input directory)
|
||||
|
@ -15,14 +15,14 @@
|
|||
// Extract game ids from disk images
|
||||
// Pull disc cover URLs and titles from GamesDb/TheGamesDb
|
||||
|
||||
bool IsBootableExecutablePath(const boost::filesystem::path& filePath)
|
||||
bool IsBootableExecutablePath(const fs::path& filePath)
|
||||
{
|
||||
auto extension = filePath.extension().string();
|
||||
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
|
||||
return (extension == ".elf");
|
||||
}
|
||||
|
||||
bool IsBootableDiscImagePath(const boost::filesystem::path& filePath)
|
||||
bool IsBootableDiscImagePath(const fs::path& filePath)
|
||||
{
|
||||
auto extension = filePath.extension().string();
|
||||
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
|
||||
|
@ -32,7 +32,7 @@ bool IsBootableDiscImagePath(const boost::filesystem::path& filePath)
|
|||
(extension == ".bin");
|
||||
}
|
||||
|
||||
void TryRegisteringBootable(const boost::filesystem::path& path)
|
||||
void TryRegisteringBootable(const fs::path& path)
|
||||
{
|
||||
std::string serial;
|
||||
if(
|
||||
|
@ -44,15 +44,15 @@ void TryRegisteringBootable(const boost::filesystem::path& path)
|
|||
BootablesDb::CClient::GetInstance().RegisterBootable(path, path.filename().string().c_str(), serial.c_str());
|
||||
}
|
||||
|
||||
void ScanBootables(const boost::filesystem::path& parentPath, bool recursive)
|
||||
void ScanBootables(const fs::path& parentPath, bool recursive)
|
||||
{
|
||||
for(auto pathIterator = boost::filesystem::directory_iterator(parentPath);
|
||||
pathIterator != boost::filesystem::directory_iterator(); pathIterator++)
|
||||
for(auto pathIterator = fs::directory_iterator(parentPath);
|
||||
pathIterator != fs::directory_iterator(); pathIterator++)
|
||||
{
|
||||
auto& path = pathIterator->path();
|
||||
try
|
||||
{
|
||||
if(recursive && boost::filesystem::is_directory(path))
|
||||
if(recursive && fs::is_directory(path))
|
||||
{
|
||||
ScanBootables(path, recursive);
|
||||
continue;
|
||||
|
@ -66,9 +66,9 @@ void ScanBootables(const boost::filesystem::path& parentPath, bool recursive)
|
|||
}
|
||||
}
|
||||
|
||||
std::set<boost::filesystem::path> GetActiveBootableDirectories()
|
||||
std::set<fs::path> GetActiveBootableDirectories()
|
||||
{
|
||||
std::set<boost::filesystem::path> result;
|
||||
std::set<fs::path> result;
|
||||
auto bootables = BootablesDb::CClient::GetInstance().GetBootables();
|
||||
for(const auto& bootable : bootables)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ void PurgeInexistingFiles()
|
|||
auto bootables = BootablesDb::CClient::GetInstance().GetBootables();
|
||||
for(const auto& bootable : bootables)
|
||||
{
|
||||
if(boost::filesystem::exists(bootable.path)) continue;
|
||||
if(fs::exists(bootable.path)) continue;
|
||||
BootablesDb::CClient::GetInstance().UnregisterBootable(bootable.path);
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void FetchGameTitles()
|
|||
|
||||
void FetchGameCovers()
|
||||
{
|
||||
auto coverpath(CAppConfig::GetBasePath() / boost::filesystem::path("covers"));
|
||||
auto coverpath(CAppConfig::GetBasePath() / fs::path("covers"));
|
||||
Framework::PathUtils::EnsurePathExists(coverpath);
|
||||
|
||||
auto bootables = BootablesDb::CClient::GetInstance().GetBootables();
|
||||
|
@ -151,7 +151,7 @@ void FetchGameCovers()
|
|||
continue;
|
||||
|
||||
auto path = coverpath / (bootable.discId + ".jpg");
|
||||
if(boost::filesystem::exists(path))
|
||||
if(fs::exists(path))
|
||||
continue;
|
||||
|
||||
auto requestResult =
|
||||
|
@ -162,9 +162,8 @@ void FetchGameCovers()
|
|||
}();
|
||||
if(requestResult.statusCode == Framework::Http::HTTP_STATUS_CODE::OK)
|
||||
{
|
||||
auto myfile = std::fstream(path.c_str(), std::ios::out | std::ios::binary);
|
||||
myfile.write(reinterpret_cast<char*>(requestResult.data.GetBuffer()), requestResult.data.GetSize());
|
||||
myfile.close();
|
||||
auto outputStream = Framework::CreateOutputStdStream(path.native());
|
||||
outputStream.Write(requestResult.data.GetBuffer(), requestResult.data.GetSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "filesystem_def.h"
|
||||
#include <set>
|
||||
|
||||
bool IsBootableExecutablePath(const boost::filesystem::path&);
|
||||
bool IsBootableDiscImagePath(const boost::filesystem::path&);
|
||||
void TryRegisteringBootable(const boost::filesystem::path&);
|
||||
void ScanBootables(const boost::filesystem::path&, bool = true);
|
||||
std::set<boost::filesystem::path> GetActiveBootableDirectories();
|
||||
bool IsBootableExecutablePath(const fs::path&);
|
||||
bool IsBootableDiscImagePath(const fs::path&);
|
||||
void TryRegisteringBootable(const fs::path&);
|
||||
void ScanBootables(const fs::path&, bool = true);
|
||||
std::set<fs::path> GetActiveBootableDirectories();
|
||||
void PurgeInexistingFiles();
|
||||
void FetchGameTitles();
|
||||
void FetchGameCovers();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue