diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-05 07:15:55 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 45e00fd7c7695adb9d69e8621ab76fdfa085900b (patch) | |
tree | 167d2a660db7bc4bdc199a438b8255ffc8b45cca /src/FileUtil.cpp | |
parent | 5250cb90406693163763a214af95f670e0e3a4e0 (diff) |
Fix for windows & mingw
Diffstat (limited to 'src/FileUtil.cpp')
-rw-r--r-- | src/FileUtil.cpp | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index e317304..ae24996 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -1,6 +1,5 @@ #include "../include/FileUtil.hpp" #include <cstdio> -#include <fstream> #if OS_FAMILY == OS_FAMILY_POSIX #include <unistd.h> @@ -8,7 +7,7 @@ #include <pwd.h> #include <fcntl.h> #else -#include <UserEnv.h> +#include <userenv.h> // Copied from linux libc sys/stat.h: #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) @@ -498,30 +497,4 @@ namespace sibs return pathIndex == path.size() && otherPathIndex == otherPath.size(); } - - Result<bool> copyFile(const FileString &src, const FileString &dst) - { - ifstream srcFile(src.c_str(), ios::binary); - if(!srcFile) - { - string errMsg = "Failed to open file "; - errMsg += toUtf8(src); - errMsg += ", reason: "; - errMsg += strerror(errno); - return Result<bool>::Err(errMsg); - } - - ofstream dstFile(dst.c_str(), ios::binary); - if(!dstFile) - { - string errMsg = "Failed to create/overwrite file "; - errMsg += toUtf8(dst); - errMsg += ", reason: "; - errMsg += strerror(errno); - return Result<bool>::Err(errMsg); - } - - dstFile << srcFile.rdbuf(); - return Result<bool>::Ok(true); - } } |