summaryrefslogtreecommitdiffstats
path: root/src/common/file_util.cpp
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2018-07-02 19:10:41 +0200
committerbunnei <bunneidev@gmail.com>2018-07-03 03:45:47 +0200
commit6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff (patch)
treec69305f1bca02461e4af8dc20f0b47601f276fc0 /src/common/file_util.cpp
parentUpdate clang format (diff)
downloadyuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.gz
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.bz2
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.lz
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.xz
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.tar.zst
yuzu-6269a01b4e9963ffdaf98ddf5d5f2a90d49e58ff.zip
Diffstat (limited to '')
-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
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