2019-12-09 11:57:37 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2019-12-09 11:57:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
2021-10-01 02:21:08 +00:00
|
|
|
#include <stratosphere/fs/fs_common.hpp>
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
namespace ams::fs {
|
|
|
|
|
2020-03-08 08:06:23 +00:00
|
|
|
namespace fsa {
|
|
|
|
|
2022-03-24 23:21:03 +00:00
|
|
|
class IFileSystem;
|
2020-03-08 08:06:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
enum OpenMode {
|
2022-03-06 20:08:20 +00:00
|
|
|
OpenMode_Read = (1 << 0),
|
|
|
|
OpenMode_Write = (1 << 1),
|
2020-03-08 23:33:49 +00:00
|
|
|
OpenMode_AllowAppend = (1 << 2),
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
OpenMode_ReadWrite = (OpenMode_Read | OpenMode_Write),
|
2020-03-08 23:33:49 +00:00
|
|
|
OpenMode_All = (OpenMode_ReadWrite | OpenMode_AllowAppend),
|
2019-12-09 11:57:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum OpenDirectoryMode {
|
2022-03-06 20:08:20 +00:00
|
|
|
OpenDirectoryMode_Directory = (1 << 0),
|
|
|
|
OpenDirectoryMode_File = (1 << 1),
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
OpenDirectoryMode_All = (OpenDirectoryMode_Directory | OpenDirectoryMode_File),
|
|
|
|
|
|
|
|
/* TODO: Separate enum, like N? */
|
2022-03-06 20:08:20 +00:00
|
|
|
OpenDirectoryMode_NotRequireFileSize = (1 << 31),
|
2019-12-09 11:57:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum DirectoryEntryType {
|
2022-03-06 20:08:20 +00:00
|
|
|
DirectoryEntryType_Directory = 0,
|
|
|
|
DirectoryEntryType_File = 1,
|
2019-12-09 11:57:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum CreateOption {
|
2022-03-06 20:08:20 +00:00
|
|
|
CreateOption_None = (0 << 0),
|
|
|
|
CreateOption_BigFile = (1 << 0),
|
2019-12-09 11:57:37 +00:00
|
|
|
};
|
|
|
|
|
2020-03-08 08:06:23 +00:00
|
|
|
struct FileHandle;
|
|
|
|
struct DirectoryHandle;
|
|
|
|
|
|
|
|
Result CreateFile(const char *path, s64 size);
|
|
|
|
Result CreateFile(const char* path, s64 size, int option);
|
|
|
|
Result DeleteFile(const char *path);
|
|
|
|
Result CreateDirectory(const char *path);
|
|
|
|
Result DeleteDirectory(const char *path);
|
|
|
|
Result DeleteDirectoryRecursively(const char *path);
|
|
|
|
Result RenameFile(const char *old_path, const char *new_path);
|
|
|
|
Result RenameDirectory(const char *old_path, const char *new_path);
|
|
|
|
Result GetEntryType(DirectoryEntryType *out, const char *path);
|
|
|
|
Result OpenFile(FileHandle *out_file, const char *path, int mode);
|
|
|
|
Result OpenDirectory(DirectoryHandle *out_dir, const char *path, int mode);
|
|
|
|
Result CleanDirectoryRecursively(const char *path);
|
|
|
|
Result GetFreeSpaceSize(s64 *out, const char *path);
|
|
|
|
Result GetTotalSpaceSize(s64 *out, const char *path);
|
|
|
|
|
|
|
|
Result SetConcatenationFileAttribute(const char *path);
|
|
|
|
|
|
|
|
Result OpenFile(FileHandle *out, std::unique_ptr<fsa::IFile> &&file, int mode);
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|