aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-25 17:48:53 +0800
committercrupest <crupest@outlook.com>2022-01-25 17:48:53 +0800
commit71c01a175a939d1a519ab235fdfdeec1101f8b84 (patch)
tree5d639e2f7bdfd08348e41bb2a64c67f0c5662d2f /src
parent839292efaaf8d997b2cbca7abae8c6e575f6c01a (diff)
downloadcru-71c01a175a939d1a519ab235fdfdeec1101f8b84.tar.gz
cru-71c01a175a939d1a519ab235fdfdeec1101f8b84.tar.bz2
cru-71c01a175a939d1a519ab235fdfdeec1101f8b84.zip
...
Diffstat (limited to 'src')
-rw-r--r--src/common/CMakeLists.txt4
-rw-r--r--src/common/platform/unix/ErrnoException.cpp (renamed from src/common/ErrnoException.cpp)8
-rw-r--r--src/common/platform/unix/UnixFileStream.cpp (renamed from src/common/io/UnixFileStream.cpp)11
3 files changed, 12 insertions, 11 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 481205a0..200ea7fa 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -17,8 +17,8 @@ target_compile_definitions(cru_base PUBLIC $<$<CONFIG:Debug>:CRU_DEBUG>)
if (UNIX)
target_sources(cru_base PRIVATE
- ErrnoException.cpp
- io/UnixFileStream.cpp
+ platform/unix/ErrnoException.cpp
+ platform/unix/UnixFileStream.cpp
)
endif()
diff --git a/src/common/ErrnoException.cpp b/src/common/platform/unix/ErrnoException.cpp
index 731ae3e5..14e6a5a2 100644
--- a/src/common/ErrnoException.cpp
+++ b/src/common/platform/unix/ErrnoException.cpp
@@ -1,14 +1,14 @@
-#include "cru/common/ErrnoException.hpp"
+#include "cru/common/platform/unix/ErrnoException.hpp"
#include "cru/common/Format.hpp"
#include <errno.h>
-namespace cru {
+namespace cru::platform::unix {
ErrnoException::ErrnoException(const String& message)
: ErrnoException(message, errno) {}
ErrnoException::ErrnoException(const String& message, int errno_code)
- : Exception(Format(u"{}. Errno is {}.", message, errno_code)),
+ : PlatformException(Format(u"{}. Errno is {}.", message, errno_code)),
errno_code_(errno_code) {}
-} // namespace cru
+} // namespace cru::platform::unix
diff --git a/src/common/io/UnixFileStream.cpp b/src/common/platform/unix/UnixFileStream.cpp
index 615c36f1..bb8d4207 100644
--- a/src/common/io/UnixFileStream.cpp
+++ b/src/common/platform/unix/UnixFileStream.cpp
@@ -1,13 +1,14 @@
-#include "cru/common/io/UnixFileStream.hpp"
-#include "cru/common/ErrnoException.hpp"
-#include "cru/common/io/OpenFileFlag.hpp"
+#include "cru/common/platform/unix/UnixFileStream.hpp"
#include "cru/common/Format.hpp"
+#include "cru/common/io/OpenFileFlag.hpp"
+#include "cru/common/platform/unix/ErrnoException.hpp"
#include <fcntl.h>
#include <sys/_types/_s_ifmt.h>
#include <unistd.h>
-namespace cru::io {
+namespace cru::platform::unix {
+using namespace cru::io;
namespace {
int MapOpenFileFlag(OpenFileFlag flags) {
@@ -131,4 +132,4 @@ void UnixFileStream::CheckClosed() {
throw Exception(u"File is closed.");
}
}
-} // namespace cru::io
+} // namespace cru::platform::unix