mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-24 19:14:40 +00:00
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include "fs.h"
|
|
|
|
#include <algorithm>
|
|
|
|
namespace Core::FileSys {
|
|
void MntPoints::mount(const std::string& host_folder, const std::string& guest_folder) {
|
|
std::unique_lock lock{m_mutex};
|
|
|
|
MntPair pair;
|
|
pair.host_path = host_folder;
|
|
pair.guest_path = guest_folder;
|
|
|
|
m_mnt_pairs.push_back(pair);
|
|
}
|
|
void MntPoints::unmount(const std::string& path) {}//TODO!
|
|
void MntPoints::unmountAll() {
|
|
std::unique_lock lock{m_mutex};
|
|
m_mnt_pairs.clear();
|
|
}
|
|
std::string MntPoints::getHostDirectory(const std::string& guest_directory) {
|
|
std::unique_lock lock{m_mutex};
|
|
for (auto& pair : m_mnt_pairs) {
|
|
if (pair.guest_path.starts_with(guest_directory)) {
|
|
return pair.host_path + guest_directory;
|
|
}
|
|
}
|
|
// hack for relative path , get app0 and assuming it goes from there
|
|
for (auto& pair : m_mnt_pairs) {
|
|
if (pair.guest_path.starts_with("/app0")) {
|
|
std::replace(pair.host_path.begin(), pair.host_path.end(), '\\', '/');
|
|
return pair.host_path + guest_directory;
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
} // namespace Core::FileSys
|