summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-05-23 19:52:40 +0200
committerLioncash <mathew1800@gmail.com>2019-05-23 19:52:43 +0200
commit2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9 (patch)
tree129596d2ff096166c68af0f39ebf6dda8d7a7ff9 /src
parentcommon/file_util: Remove unnecessary c_str() calls (diff)
downloadyuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.tar
yuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.tar.gz
yuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.tar.bz2
yuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.tar.lz
yuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.tar.xz
yuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.tar.zst
yuzu-2b1fcc8a14d93c16ce00e1a9888e3f4f839f18f9.zip
Diffstat (limited to '')
-rw-r--r--src/common/file_util.cpp6
-rw-r--r--src/common/file_util.h4
-rw-r--r--src/yuzu_cmd/config.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index aecb66c32..8a902dd68 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -762,11 +762,11 @@ std::string GetNANDRegistrationDir(bool system) {
return GetUserPath(UserPath::NANDDir) + "user/Contents/registered/";
}
-std::size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) {
- return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
+std::size_t WriteStringToFile(bool text_file, const std::string& filename, std::string_view str) {
+ return IOFile(filename, text_file ? "w" : "wb").WriteString(str);
}
-std::size_t ReadFileToString(bool text_file, const char* filename, std::string& str) {
+std::size_t ReadFileToString(bool text_file, const std::string& filename, std::string& str) {
IOFile file(filename, text_file ? "r" : "rb");
if (!file.IsOpen())
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 88760be2f..c325f5b49 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -146,9 +146,9 @@ const std::string& GetExeDirectory();
std::string AppDataRoamingDirectory();
#endif
-std::size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename);
+std::size_t WriteStringToFile(bool text_file, const std::string& filename, std::string_view str);
-std::size_t ReadFileToString(bool text_file, const char* filename, std::string& str);
+std::size_t ReadFileToString(bool text_file, const std::string& filename, std::string& str);
/**
* Splits the filename into 8.3 format
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index d0ae058fd..730956427 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -26,12 +26,12 @@ Config::Config() {
Config::~Config() = default;
bool Config::LoadINI(const std::string& default_contents, bool retry) {
- const char* location = this->sdl2_config_loc.c_str();
+ const std::string& location = this->sdl2_config_loc;
if (sdl2_config->ParseError() < 0) {
if (retry) {
LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
FileUtil::CreateFullPath(location);
- FileUtil::WriteStringToFile(true, default_contents, location);
+ FileUtil::WriteStringToFile(true, location, default_contents);
sdl2_config = std::make_unique<INIReader>(location); // Reopen file
return LoadINI(default_contents, false);