diff options
Diffstat (limited to '')
| -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 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 | ||
| 800 | IOFile::IOFile() {} | 802 | IOFile::IOFile() {} |
| 801 | 803 | ||
| 802 | IOFile::IOFile(const std::string& filename, const char openmode[]) { | 804 | IOFile::IOFile(const std::string& filename, const char openmode[], int flags) { |
| 803 | Open(filename, openmode); | 805 | Open(filename, openmode, flags); |
| 804 | } | 806 | } |
| 805 | 807 | ||
| 806 | IOFile::~IOFile() { | 808 | IOFile::~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 | ||
| 824 | bool IOFile::Open(const std::string& filename, const char openmode[]) { | 826 | bool 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 |