haze: fixes for windows

This commit is contained in:
Liam 2023-04-16 01:26:29 -04:00
parent 014bbcfe56
commit 0ba4cc2004
3 changed files with 12 additions and 8 deletions

View file

@ -99,8 +99,8 @@ namespace haze {
R_RETURN(this->ForwardResult(fsFsCreateDirectory, m_filesystem, path));
}
Result DeleteDirectory(const char* path) {
R_RETURN(this->ForwardResult(fsFsDeleteDirectory, m_filesystem, path));
Result DeleteDirectoryRecursively(const char* path) {
R_RETURN(this->ForwardResult(fsFsDeleteDirectoryRecursively, m_filesystem, path));
}
Result OpenDirectory(const char *path, u32 mode, FsDir *out_dir) {

View file

@ -129,7 +129,7 @@ namespace haze {
template <typename T>
Result AddString(const T *str) {
/* Use one less maximum string length for maximum length with null terminator. */
/* Use one less than the maximum string length for maximum length with null terminator. */
const u8 len = static_cast<u8>(std::min<s32>(util::Strlen(str), PtpStringMaxLength - 1));
if (len > 0) {

View file

@ -62,7 +62,11 @@ namespace haze {
constexpr const PtpEventCode SupportedEventCodes[] = { /* ... */};
constexpr const PtpDevicePropertyCode SupportedPropertyCodes[] = { /* ...*/ };
constexpr const PtpObjectFormatCode SupportedCaptureFormats[] = { /* ...*/ };
constexpr const PtpObjectFormatCode SupportedPlaybackFormats[] = { /* ...*/ };
constexpr const PtpObjectFormatCode SupportedPlaybackFormats[] = {
PtpObjectFormatCode_Undefined,
PtpObjectFormatCode_Association,
};
constexpr const StorageId SupportedStorageIds[] = {
StorageId_SdmcFs,
@ -592,8 +596,8 @@ namespace haze {
/* Make a new object with the intended name. */
PtpNewObjectInfo new_object_info;
new_object_info.storage_id = StorageId_SdmcFs;
new_object_info.parent_object_id = parent_object;
new_object_info.storage_id = StorageId_SdmcFs;
new_object_info.parent_object_id = parent_object == storage_id ? 0 : parent_object;
R_TRY(m_object_database.AddObjectId(parentobj->GetName(), g_filename_str, std::addressof(new_object_info.object_id), parentobj->GetObjectId()));
@ -605,7 +609,7 @@ namespace haze {
R_UNLESS(fileobj != nullptr, haze::ResultGeneralFailure());
/* Create the object on the filesystem. */
if (info.association_type == PtpAssociationType_GenericFolder) {
if (info.object_format == PtpObjectFormatCode_Association) {
R_TRY(m_fs.CreateDirectory(fileobj->GetName()));
m_send_object_id = 0;
} else {
@ -685,7 +689,7 @@ namespace haze {
/* Remove the object from the filesystem. */
if (entry_type == FsDirEntryType_Dir) {
R_TRY(m_fs.DeleteDirectory(fileobj->GetName()));
R_TRY(m_fs.DeleteDirectoryRecursively(fileobj->GetName()));
} else {
R_TRY(m_fs.DeleteFile(fileobj->GetName()));
}