aboutsummaryrefslogtreecommitdiff
path: root/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorMatt Peters <[email protected]>2022-01-10 10:57:59 -0700
committerMatt Peters <[email protected]>2022-01-10 10:57:59 -0700
commit4a12683b27adb31bde9eb8f7df3b9e9cc8ec680a (patch)
treec8b2939d400dd4bccae73d2782b15c65d30db19d /zencore/filesystem.cpp
parentAdd WaitForQuiescence RPC (diff)
parentTwo missing override keywords (diff)
downloadzen-wait_for_quiescence.tar.xz
zen-wait_for_quiescence.zip
Merge branch 'main' into wait_for_quiescencewait_for_quiescence
Diffstat (limited to 'zencore/filesystem.cpp')
-rw-r--r--zencore/filesystem.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index 2507037ea..bed08b3f5 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -487,8 +487,6 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
&CancelFlag,
/* dwCopyFlags */ 0);
#else
- using namespace fmt::literals;
-
struct ScopedFd
{
~ScopedFd() { close(Fd); }
@@ -499,7 +497,7 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
int FromFd = open(FromPath.c_str(), O_RDONLY | O_CLOEXEC);
if (FromFd < 0)
{
- ThrowLastError("failed to open file {}"_format(FromPath));
+ ThrowLastError(fmt::format("failed to open file {}", FromPath));
}
ScopedFd $From = {FromFd};
@@ -507,7 +505,7 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
int ToFd = open(ToPath.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0644);
if (ToFd < 0)
{
- ThrowLastError("failed to create file {}"_format(ToPath));
+ ThrowLastError(fmt::format("failed to create file {}", ToPath));
}
ScopedFd $To = {ToFd};
@@ -543,8 +541,6 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
void
WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t BufferCount)
{
- using namespace fmt::literals;
-
#if ZEN_PLATFORM_WINDOWS
CAtlFile Outfile;
HRESULT hRes = Outfile.Create(Path.c_str(), GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS);
@@ -557,7 +553,7 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "File open failed for '{}'"_format(Path).c_str());
+ ThrowSystemException(hRes, fmt::format("File open failed for '{}'", Path).c_str());
}
#else
@@ -571,7 +567,7 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
if (Fd < 0)
{
- ThrowLastError("File open failed for '{}'"_format(Path));
+ ThrowLastError(fmt::format("File open failed for '{}'", Path));
}
#endif
@@ -590,12 +586,12 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
hRes = Outfile.Write(DataPtr, gsl::narrow_cast<uint32_t>(WriteSize));
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "File write failed for '{}'"_format(Path).c_str());
+ ThrowSystemException(hRes, fmt::format("File write failed for '{}'", Path).c_str());
}
#else
if (write(Fd, DataPtr, WriteSize) != int64_t(WriteSize))
{
- ThrowLastError("File write failed for '{}'"_format(Path));
+ ThrowLastError(fmt::format("File write failed for '{}'", Path));
}
#endif // ZEN_PLATFORM_WINDOWS
@@ -867,14 +863,12 @@ FileSystemTraversal::TraverseFileSystem(const std::filesystem::path& RootDir, Tr
}
}
#else
- using namespace fmt::literals;
-
/* Could also implement this using Linux's getdents() syscall */
DIR* Dir = opendir(RootDir.c_str());
if (Dir == nullptr)
{
- ThrowLastError("Failed to open directory for traversal: {}"_format(RootDir.c_str()));
+ ThrowLastError(fmt::format("Failed to open directory for traversal: {}", RootDir.c_str()));
}
for (struct dirent* Entry; (Entry = readdir(Dir));)