summaryrefslogtreecommitdiff
path: root/src/common/file_util.cpp
diff options
context:
space:
mode:
authorGravatar James Rowe2018-07-02 11:10:41 -0600
committerGravatar bunnei2018-07-02 21:45:47 -0400
commit6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff (patch)
treec69305f1bca02461e4af8dc20f0b47601f276fc0 /src/common/file_util.cpp
parentUpdate clang format (diff)
downloadyuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.gz
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.xz
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.zip
Add configurable logging backends
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r--src/common/file_util.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 2152e3fea..b9e1fd1f6 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
713 paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; 713 paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
714 paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; 714 paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
715 paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; 715 paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP;
716 // TODO: Put the logs in a better location for each OS
717 paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOG_DIR DIR_SEP;
716 } 718 }
717 719
718 if (!newPath.empty()) { 720 if (!newPath.empty()) {
@@ -799,8 +801,8 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
799 801
800IOFile::IOFile() {} 802IOFile::IOFile() {}
801 803
802IOFile::IOFile(const std::string& filename, const char openmode[]) { 804IOFile::IOFile(const std::string& filename, const char openmode[], int flags) {
803 Open(filename, openmode); 805 Open(filename, openmode, flags);
804} 806}
805 807
806IOFile::~IOFile() { 808IOFile::~IOFile() {
@@ -821,11 +823,16 @@ void IOFile::Swap(IOFile& other) noexcept {
821 std::swap(m_good, other.m_good); 823 std::swap(m_good, other.m_good);
822} 824}
823 825
824bool IOFile::Open(const std::string& filename, const char openmode[]) { 826bool IOFile::Open(const std::string& filename, const char openmode[], int flags) {
825 Close(); 827 Close();
826#ifdef _WIN32 828#ifdef _WIN32
827 _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), 829 if (flags != 0) {
828 Common::UTF8ToUTF16W(openmode).c_str()); 830 m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(),
831 Common::UTF8ToUTF16W(openmode).c_str(), flags);
832 } else {
833 _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(),
834 Common::UTF8ToUTF16W(openmode).c_str());
835 }
829#else 836#else
830 m_file = fopen(filename.c_str(), openmode); 837 m_file = fopen(filename.c_str(), openmode);
831#endif 838#endif