2020-11-11 20:06:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Files/Volume.h"
|
|
|
|
#include "CompilerSupport/filesystem.h"
|
2023-09-17 19:26:05 +00:00
|
|
|
#include "Utilities/StringUtils.h"
|
2020-11-11 20:06:52 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Pomme::Files
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Volume implementation that lets the Mac app access files
|
|
|
|
* on the host system's filesystem.
|
|
|
|
*/
|
|
|
|
class HostVolume : public Volume
|
|
|
|
{
|
|
|
|
std::vector<fs::path> directories;
|
|
|
|
|
2023-09-17 19:26:05 +00:00
|
|
|
fs::path ToPath(long parID, const char* name);
|
|
|
|
fs::path ToPath(long parID, const u8string& name);
|
2020-11-11 20:06:52 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit HostVolume(short vRefNum);
|
|
|
|
|
|
|
|
virtual ~HostVolume() = default;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Utilities
|
|
|
|
|
|
|
|
long GetDirectoryID(const fs::path& dirPath);
|
|
|
|
|
|
|
|
FSSpec ToFSSpec(const fs::path& fullPath);
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Toolbox API Implementation
|
|
|
|
|
2023-09-17 19:26:05 +00:00
|
|
|
OSErr FSMakeFSSpec(long dirID, const u8string& fileName, FSSpec* spec) override;
|
2020-11-11 20:06:52 +00:00
|
|
|
|
|
|
|
OSErr OpenFork(const FSSpec* spec, ForkType forkType, char permission, std::unique_ptr<ForkHandle>& stream) override;
|
|
|
|
|
|
|
|
OSErr FSpCreate(const FSSpec* spec, OSType creator, OSType fileType, ScriptCode scriptTag) override;
|
|
|
|
|
|
|
|
OSErr FSpDelete(const FSSpec* spec) override;
|
|
|
|
|
2023-09-17 19:26:05 +00:00
|
|
|
OSErr DirCreate(long parentDirID, const u8string& directoryName, long* createdDirID) override;
|
2020-11-11 20:06:52 +00:00
|
|
|
};
|
|
|
|
}
|