Lime3DS/src/citra
Tobias ef73de9386
Port yuzu-emu/yuzu#2511: "common/file_util: Minor cleanup" (#4782)
* common/file_util: Make IOFile's WriteString take a std::string_view

We don't need to force the usage of a std::string here, and can instead
use a std::string_view, which allows writing out other forms of strings
(e.g. C-style strings) without any unnecessary heap allocations.

* common/file_util: Remove unnecessary c_str() calls

The file stream open functions have supported std::string overloads
since C++11, so we don't need to use c_str() here. Same behavior, less
code.

* common/file_util: Make ReadFileToString and WriteStringToFile consistent

Makes the parameter ordering consistent, and also makes the filename
parameter a std::string. A std::string would be constructed anyways with
the previous code, as IOFile's only constructor with a filepath is one
taking a std::string.

We can also make WriteStringToFile's string parameter utilize a
std::string_view for the string, making use of our previous changes to
IOFile.

* common/file_util: Remove duplicated documentation comments

These are already present within the header, so they don't need to be
repeated in the cpp file.

* common/file_util: Make GetCurrentDir() return a std::optional

nullptr was being returned in the error case, which, at a glance may
seem perfectly OK... until you realize that std::string has the
invariant that it may not be constructed from a null pointer. This
means that if this error case was ever hit, then the application would
most likely crash from a thrown exception in std::string's constructor.

Instead, we can change the function to return an optional value,
indicating if a failure occurred.

* common/file_util: Remove unnecessary return at end of void StripTailDirSlashes()

While we're at it, also invert the conditional into a guard clause.
2019-06-08 00:23:57 +02:00
..
emu_window core: Namespace EmuWindow 2019-04-21 14:16:16 +02:00
citra.cpp Merge pull request #4681 from FearlessTobi/port-2188-2190 2019-04-09 21:18:34 +02:00
citra.rc Add manifest 2017-09-02 20:08:11 -04:00
CMakeLists.txt CMakeLists: Derive the source directory grouping from targets themselves 2017-12-11 21:11:52 -05:00
config.cpp Port yuzu-emu/yuzu#2511: "common/file_util: Minor cleanup" (#4782) 2019-06-08 00:23:57 +02:00
config.h Citra: Convert include into forward declaration 2017-05-27 18:41:24 -07:00
default_ini.h sdl: add GLES support 2019-02-03 15:58:09 -06:00
resource.h Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00