initial dents support

This commit is contained in:
georgemoralis 2024-06-20 18:09:40 +03:00
parent 0325e4795a
commit 49601f58ed
5 changed files with 128 additions and 24 deletions

View file

@ -28,15 +28,13 @@ void MntPoints::UnmountAll() {
std::string MntPoints::GetHostDirectory(const std::string& guest_directory) {
std::scoped_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")) {
// horrible code but it works :D
int find = guest_directory.find(pair.guest_path);
if (find == 0) {
std::string npath =
guest_directory.substr(pair.guest_path.size(), guest_directory.size() - 1);
std::replace(pair.host_path.begin(), pair.host_path.end(), '\\', '/');
return pair.host_path + guest_directory;
return pair.host_path + npath;
}
}
return "";

View file

@ -32,13 +32,18 @@ private:
std::mutex m_mutex;
};
struct DirEntry {
std::string name;
bool isFile;
};
struct File {
std::atomic_bool is_opened{};
std::atomic_bool is_directory{};
std::string m_host_name;
std::string m_guest_name;
Common::FS::IOFile f;
// std::vector<Common::FS::DirEntry> dirents;
std::vector<DirEntry> dirents;
u32 dirents_index;
std::mutex m_mutex;
};