summaryrefslogtreecommitdiff
path: root/klm/util/file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'klm/util/file.cc')
-rw-r--r--klm/util/file.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/klm/util/file.cc b/klm/util/file.cc
index de206bc8..6a3885a7 100644
--- a/klm/util/file.cc
+++ b/klm/util/file.cc
@@ -10,11 +10,12 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
-#include <unistd.h>
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <io.h>
+#else
+#include <unistd.h>
#endif
namespace util {
@@ -43,16 +44,6 @@ int OpenReadOrThrow(const char *name) {
return ret;
}
-int CreateOrThrow(const char *name) {
- int ret;
-#if defined(_WIN32) || defined(_WIN64)
- UTIL_THROW_IF(-1 == (ret = _open(name, _O_CREAT | _O_TRUNC | _O_RDWR, _S_IREAD | _S_IWRITE)), ErrnoException, "while creating " << name);
-#else
- UTIL_THROW_IF(-1 == (ret = open(name, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)), ErrnoException, "while creating " << name);
-#endif
- return ret;
-}
-
uint64_t SizeFile(int fd) {
#if defined(_WIN32) || defined(_WIN64)
__int64 ret = _filelengthi64(fd);