diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-10-05 12:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 12:27:14 +0200 |
commit | a9031b6bae742b333b1b390192fa590f2ecb07ea (patch) | |
tree | b2802c81d24d339c201a0747d66ba44e9ea8b1b0 /src/OSSupport | |
parent | Fixed current end generator (#4968) (diff) | |
download | cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2 cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip |
Diffstat (limited to 'src/OSSupport')
-rw-r--r-- | src/OSSupport/File.cpp | 26 | ||||
-rw-r--r-- | src/OSSupport/File.h | 12 |
2 files changed, 11 insertions, 27 deletions
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp index 113acc3a5..8c5eb92a4 100644 --- a/src/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp @@ -709,29 +709,3 @@ void cFile::Flush(void) { fflush(m_File); } - - - - - -template <class StreamType> -FileStream<StreamType>::FileStream(const std::string & Path) : - StreamType() -{ - // Except on failbit, which is what open sets on failure: - FileStream::exceptions(FileStream::failbit | FileStream::badbit); - - // Open the file: - FileStream::open(Path); - - // Only subsequently except on serious errors, and not on conditions like EOF or malformed input: - FileStream::exceptions(FileStream::badbit); -} - - - - - -// Instantiate the templated wrapper for input and output: -template class FileStream<std::ifstream>; -template class FileStream<std::ofstream>; diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h index 62853ede7..59f3a5558 100644 --- a/src/OSSupport/File.h +++ b/src/OSSupport/File.h @@ -192,7 +192,17 @@ class FileStream final : public StreamType { public: - FileStream(const std::string & Path); + FileStream(const std::string & Path) + { + // Except on failbit, which is what open sets on failure: + FileStream::exceptions(FileStream::failbit | FileStream::badbit); + + // Open the file: + FileStream::open(Path); + + // Only subsequently except on serious errors, and not on conditions like EOF or malformed input: + FileStream::exceptions(FileStream::badbit); + } }; |