mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 21:05:50 +12:00
Add ExtSaveData::CreateDirectory and stub srv::unsubscribe
This commit is contained in:
parent
12392b9cd5
commit
e67dc65118
4 changed files with 32 additions and 0 deletions
|
@ -87,6 +87,27 @@ FileDescriptor ExtSaveDataArchive::openFile(const FSPath& path, const FilePerms&
|
|||
return FileError;
|
||||
}
|
||||
|
||||
HorizonResult ExtSaveDataArchive::createDirectory(const FSPath& path) {
|
||||
if (path.type == PathType::UTF16) {
|
||||
if (!isPathSafe<PathType::UTF16>(path)) {
|
||||
Helpers::panic("Unsafe path in ExtSaveData::OpenFile");
|
||||
}
|
||||
|
||||
fs::path p = IOFile::getAppData() / backingFolder;
|
||||
p += fs::path(path.utf16_string).make_preferred();
|
||||
|
||||
if (fs::is_directory(p)) return Result::FS::AlreadyExists;
|
||||
if (fs::is_regular_file(p)) {
|
||||
Helpers::panic("File path passed to ExtSaveData::CreateDirectory");
|
||||
}
|
||||
|
||||
bool success = fs::create_directory(p);
|
||||
return success ? Result::Success : Result::FS::UnexpectedFileOrDir;
|
||||
} else {
|
||||
Helpers::panic("Unimplemented ExtSaveData::CreateDirectory");
|
||||
}
|
||||
}
|
||||
|
||||
std::string ExtSaveDataArchive::getExtSaveDataPathFromBinary(const FSPath& path) {
|
||||
// TODO: Remove punning here
|
||||
const u32 mediaType = *(u32*)&path.binary[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue