From b18dcd766034aed6bd5cddc1fb1d4848ec040c66 Mon Sep 17 00:00:00 2001 From: MSuih Date: Sat, 2 May 2020 09:04:05 +0300 Subject: [PATCH] Add fs::error for when disk is full --- Utilities/File.cpp | 3 +++ Utilities/File.h | 1 + 2 files changed, 4 insertions(+) diff --git a/Utilities/File.cpp b/Utilities/File.cpp index 5a41fa9f06..d075b9c9c3 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -129,6 +129,7 @@ static fs::error to_error(DWORD e) case ERROR_DIR_NOT_EMPTY: return fs::error::notempty; case ERROR_NOT_READY: return fs::error::noent; case ERROR_FILENAME_EXCED_RANGE: return fs::error::toolong; + case ERROR_DISK_FULL: return fs::error::nospace; default: return fs::error::unknown; } } @@ -170,6 +171,7 @@ static fs::error to_error(int e) case ENOTEMPTY: return fs::error::notempty; case EROFS: return fs::error::readonly; case EISDIR: return fs::error::isdir; + case ENOSPC: return fs::error::nospace; default: return fs::error::unknown; } } @@ -1818,6 +1820,7 @@ void fmt_class_string::format(std::string& out, u64 arg) case fs::error::readonly: return "Read only"; case fs::error::isdir: return "Is a directory"; case fs::error::toolong: return "Path too long"; + case fs::error::nospace: return "Not enough space on the device"; case fs::error::unknown: return "Unknown system error"; } diff --git a/Utilities/File.h b/Utilities/File.h index 02a54bb8f8..cd635c72b0 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -516,6 +516,7 @@ namespace fs readonly, isdir, toolong, + nospace, unknown };