| 1 | #include <filedevice/seadMainFileDevice.h> |
|---|---|
| 2 | #include <prim/seadSafeString.h> |
| 3 | |
| 4 | #ifdef cafe |
| 5 | #include <filedevice/cafe/seadCafeFSAFileDeviceCafe.h> |
| 6 | #elif defined(NNSDK) |
| 7 | #include <filedevice/nin/seadNinContentFileDeviceNin.h> |
| 8 | #endif |
| 9 | |
| 10 | namespace sead |
| 11 | { |
| 12 | MainFileDevice::MainFileDevice(Heap* heap) : FileDevice("main"), mFileDevice(nullptr) |
| 13 | { |
| 14 | #ifdef cafe |
| 15 | mFileDevice = new (heap, 4) CafeContentFileDevice(); |
| 16 | #elif defined(NNSDK) |
| 17 | mFileDevice = new (heap, 8) NinContentFileDevice(); |
| 18 | #else |
| 19 | #error "Unknown platform" |
| 20 | #endif |
| 21 | SEAD_ASSERT(mFileDevice); |
| 22 | } |
| 23 | |
| 24 | MainFileDevice::~MainFileDevice() |
| 25 | { |
| 26 | if (mFileDevice == NULL) |
| 27 | return; |
| 28 | |
| 29 | delete mFileDevice; |
| 30 | mFileDevice = NULL; |
| 31 | } |
| 32 | |
| 33 | void MainFileDevice::traceFilePath(const SafeString& path) const |
| 34 | { |
| 35 | mFileDevice->traceFilePath(path); |
| 36 | } |
| 37 | |
| 38 | void MainFileDevice::traceDirectoryPath(const SafeString& path) const |
| 39 | { |
| 40 | mFileDevice->traceDirectoryPath(path); |
| 41 | } |
| 42 | |
| 43 | void MainFileDevice::resolveFilePath(BufferedSafeString* out, const SafeString& path) const |
| 44 | { |
| 45 | mFileDevice->resolveFilePath(out, path); |
| 46 | } |
| 47 | |
| 48 | void MainFileDevice::resolveDirectoryPath(BufferedSafeString* out, const SafeString& path) const |
| 49 | { |
| 50 | mFileDevice->resolveDirectoryPath(out, path); |
| 51 | } |
| 52 | } // namespace sead |
| 53 |