diff options
author | James Rowe <jroweboy@gmail.com> | 2018-07-02 11:10:41 -0600 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-07-02 21:45:47 -0400 |
commit | 6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff (patch) | |
tree | c69305f1bca02461e4af8dc20f0b47601f276fc0 /src/common/file_util.cpp | |
parent | 0d46f0df122dbc9b9a9d9f97e2da6b1953ef939b (diff) |
Add configurable logging backends
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r-- | src/common/file_util.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 2152e3feac..b9e1fd1f61 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -713,6 +713,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; + // TODO: Put the logs in a better location for each OS + paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOG_DIR DIR_SEP; } if (!newPath.empty()) { @@ -799,8 +801,8 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam IOFile::IOFile() {} -IOFile::IOFile(const std::string& filename, const char openmode[]) { - Open(filename, openmode); +IOFile::IOFile(const std::string& filename, const char openmode[], int flags) { + Open(filename, openmode, flags); } IOFile::~IOFile() { @@ -821,11 +823,16 @@ void IOFile::Swap(IOFile& other) noexcept { std::swap(m_good, other.m_good); } -bool IOFile::Open(const std::string& filename, const char openmode[]) { +bool IOFile::Open(const std::string& filename, const char openmode[], int flags) { Close(); #ifdef _WIN32 - _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), - Common::UTF8ToUTF16W(openmode).c_str()); + if (flags != 0) { + m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), + Common::UTF8ToUTF16W(openmode).c_str(), flags); + } else { + _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), + Common::UTF8ToUTF16W(openmode).c_str()); + } #else m_file = fopen(filename.c_str(), openmode); #endif |