diff options
| author | 2018-07-02 11:10:41 -0600 | |
|---|---|---|
| committer | 2018-07-02 21:45:47 -0400 | |
| commit | 6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff (patch) | |
| tree | c69305f1bca02461e4af8dc20f0b47601f276fc0 /src/common/file_util.h | |
| parent | Update clang format (diff) | |
| download | yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.gz yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.xz yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.zip | |
Add configurable logging backends
Diffstat (limited to 'src/common/file_util.h')
| -rw-r--r-- | src/common/file_util.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/file_util.h b/src/common/file_util.h index fc6b3ea46..5bc7fbf7c 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h | |||
| @@ -156,7 +156,10 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam | |||
| 156 | class IOFile : public NonCopyable { | 156 | class IOFile : public NonCopyable { |
| 157 | public: | 157 | public: |
| 158 | IOFile(); | 158 | IOFile(); |
| 159 | IOFile(const std::string& filename, const char openmode[]); | 159 | // flags is used for windows specific file open mode flags, which |
| 160 | // allows yuzu to open the logs in shared write mode, so that the file | ||
| 161 | // isn't considered "locked" while yuzu is open and people can open the log file and view it | ||
| 162 | IOFile(const std::string& filename, const char openmode[], int flags = 0); | ||
| 160 | 163 | ||
| 161 | ~IOFile(); | 164 | ~IOFile(); |
| 162 | 165 | ||
| @@ -165,7 +168,7 @@ public: | |||
| 165 | 168 | ||
| 166 | void Swap(IOFile& other) noexcept; | 169 | void Swap(IOFile& other) noexcept; |
| 167 | 170 | ||
| 168 | bool Open(const std::string& filename, const char openmode[]); | 171 | bool Open(const std::string& filename, const char openmode[], int flags = 0); |
| 169 | bool Close(); | 172 | bool Close(); |
| 170 | 173 | ||
| 171 | template <typename T> | 174 | template <typename T> |
| @@ -220,6 +223,10 @@ public: | |||
| 220 | return WriteArray(&object, 1); | 223 | return WriteArray(&object, 1); |
| 221 | } | 224 | } |
| 222 | 225 | ||
| 226 | size_t WriteString(const std::string& str) { | ||
| 227 | return WriteArray(str.c_str(), str.length()); | ||
| 228 | } | ||
| 229 | |||
| 223 | bool IsOpen() const { | 230 | bool IsOpen() const { |
| 224 | return nullptr != m_file; | 231 | return nullptr != m_file; |
| 225 | } | 232 | } |