Commit Graph

103 Commits

Author SHA1 Message Date
Zach Hilman
84d4a7eaaf common_paths: Add Load and Dump dirs 2018-09-21 19:53:05 -04:00
fearlessTobi
ac0723e7be Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
Lioncash
4f1a5f4de6 file_util: Correct return value in early exit of ReadFileToString()
While still essentially being zero, we should be returning a numeric
value here, not a boolean typed value.
2018-08-24 02:20:02 -04:00
Zach Hilman
61edb6ba8d file_util: Add getter for NAND registration directory 2018-08-11 22:50:08 -04:00
Zach Hilman
b59227654e file_util: Use enum instead of bool for specifing path behavior 2018-08-08 21:18:45 -04:00
Zach Hilman
1bd49bc69b file_util: Add platform-specific slash option to SanitizePath 2018-08-08 21:18:45 -04:00
Zach Hilman
35c20735f0 Allow key loading from %YUZU_DIR%/keys in addition to ~/.switch 2018-08-01 00:16:54 -04:00
Zach Hilman
ef6054b4e4 Use SHGetKnownFolderPath instead of SHGetFolderPathA 2018-08-01 00:16:54 -04:00
Zach Hilman
7cf7242a2d Extract mbedtls to cpp file 2018-08-01 00:16:54 -04:00
Zach Hilman
2f355a1609 Remove files that are not used 2018-08-01 00:16:54 -04:00
Zach Hilman
ea285f9107 VFS Regression and Accuracy Fixes (#776)
* Regression and Mode Fixes

* Review Fixes

* string_view correction

* Add operator& for FileSys::Mode

* Return std::string from SanitizePath

* Farming Simulator Fix

* Use != With mode operator&
2018-07-23 19:40:35 -07:00
bunnei
facf50271e Merge pull request #768 from lioncash/string-view
file_util, vfs: Use std::string_view where applicable
2018-07-22 11:32:28 -07:00
Lioncash
81ef4d3734 file_util, vfs: Use std::string_view where applicable
Avoids unnecessary construction of std::string instances where
applicable.
2018-07-22 03:22:21 -04:00
bunnei
b210cc6a27 Merge pull request #765 from lioncash/file
file_util: Remove goto usages from Copy()
2018-07-22 00:03:35 -07:00
Lioncash
128c95d22b file_util: Remove goto usages from Copy()
We can just leverage std::unique_ptr to automatically close these for us
in error cases instead of jumping to the end of the function to call
fclose on them.
2018-07-21 23:08:55 -04:00
Lioncash
073e4cb169 file_util: Use a u64 to represent number of entries
This avoids a truncating cast on size. I doubt we'd ever traverse a
directory this large, however we also shouldn't truncate sizes away.
2018-07-21 22:42:08 -04:00
Lioncash
de1e473151 file_util: std::move FST entries in ScanDirectoryTree()
Avoids unnecessary copies when building up the FST entries.
2018-07-21 22:31:44 -04:00
bunnei
b6165907b9 Merge pull request #759 from lioncash/redundant
file_util: Remove redundant duplicate return in GetPathWithoutTop()
2018-07-21 18:50:38 -07:00
Lioncash
a0d85ece5b file_util: Use an enum class for GetUserPath()
Instead of using an unsigned int as a parameter and expecting a user to
always pass in the correct values, we can just convert the enum into an
enum class and use that type as the parameter type instead, which makes
the interface more type safe.

We also get rid of the bookkeeping "NUM_" element in the enum by just
using an unordered map. This function is generally low-frequency in
terms of calls (and I'd hope so, considering otherwise would mean we're
slamming the disk with IO all the time) so I'd consider this acceptable
in this case.
2018-07-21 16:21:19 -04:00
Lioncash
83c6aac7ec file_util: Remove explicit type from std::min() in GetPathWithoutTop()
Given both operands are the same type, there won't be an issue with
overload selection that requires making this explicit.
2018-07-21 15:19:32 -04:00
Lioncash
01d8924c26 file_util: Remove redundant duplicate return in GetPathWithoutTop() 2018-07-21 15:18:23 -04:00
Lioncash
72fd837475 file_util: return string by const reference for GetExeDirectory()
This disallows modifying the internal string buffer (which shouldn't be
modified anyhow).
2018-07-19 01:27:29 -04:00
Zach Hilman
c228e57523 Virtual Filesystem 2: Electric Boogaloo (#676)
* Virtual Filesystem

* Fix delete bug and documentate

* Review fixes + other stuff

* Fix puyo regression
2018-07-18 18:07:11 -07:00
bunnei
2b3d247c2a Revert "Virtual Filesystem (#597)"
This reverts commit 77c684c114.
2018-07-07 20:24:51 -07:00
bunnei
2b4d94ca00 Merge pull request #630 from FearlessTobi/remove-citra-references
Remove some references to Citra
2018-07-06 11:13:50 -04:00
Zach Hilman
f4e25a685f Virtual Filesystem (#597)
* Add VfsFile and VfsDirectory classes

* Finish abstract Vfs classes

* Implement RealVfsFile (computer fs backend)

* Finish RealVfsFile and RealVfsDirectory

* Finished OffsetVfsFile

* More changes

* Fix import paths

* Major refactor

* Remove double const

* Use experimental/filesystem or filesystem depending on compiler

* Port partition_filesystem

* More changes

* More Overhaul

* FSP_SRV fixes

* Fixes and testing

* Try to get filesystem to compile

* Filesystem on linux

* Remove std::filesystem and document/test

* Compile fixes

* Missing include

* Bug fixes

* Fixes

* Rename v_file and v_dir

* clang-format fix

* Rename NGLOG_* to LOG_*

* Most review changes

* Fix TODO

* Guess 'main' to be Directory by filename
2018-07-06 10:51:32 -04:00
fearlessTobi
6c8a217c30 Remove some references to Citra 2018-07-06 15:47:06 +02:00
James Rowe
3e4df3574c Add configurable logging backends 2018-07-02 21:45:47 -04:00
James Rowe
489e98954c Update clang format 2018-07-02 21:45:47 -04:00
James Rowe
847a518200 Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
Lioncash
55e1d617c6 file_util: Make move constructor/assignment operator and related functions noexcept
Without this, it's possible to get compilation failures in the (rare) scenario where
a container is used to store a bunch of live IOFile instances, as they may be using
std::move_if_noexcept under the hood. Given these definitely don't throw exceptions
this is also not incorrect to add either.
2018-04-29 18:34:09 -04:00
Lioncash
39f224d92b general: Convert assertion macros over to be fmt-compatible 2018-04-27 10:04:02 -04:00
Lioncash
758aae7ff9 common: Move logging macros over to new fmt-capable macros where applicable 2018-04-26 20:09:58 -04:00
James Rowe
7d396de27a Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
wwylele
df855674d4 file_util: Log when using local user directory 2017-03-11 18:31:17 +02:00
wwylele
d8d0f5f179 file_util: lower logging level for harmless cases 2017-03-08 17:42:10 +02:00
noah the goodra
33fcee3f1d file_util: Fixed implicit type conversion warning (#2503) 2017-01-30 20:08:00 -08:00
wwylele
e742ba3436 file_util: fix missing sysdata path 2016-12-23 22:19:14 +02:00
bunnei
b6a1478f4f file_util: Remove unused paths. 2016-12-21 23:29:12 -05:00
Jeffrey Pfau
8f8e63401a Common: Fix gcc build on macOS 2016-12-13 10:20:33 -08:00
freiro
cc42b1dc50 WINVER definition moved to CMake and cleanup 2016-11-30 15:47:09 +01:00
freiro
ecc54a90d9 Removed /user/ from path 2016-11-26 01:00:52 +01:00
freiro
835832f917 Switch to AppData/Roaming 2016-11-24 16:42:31 +01:00
freiro
c63688c1cb Return by value and other fixes 2016-11-19 15:50:16 +01:00
freiro
b95ce876f4 Win32 move default user folder location to AppData 2016-11-19 15:49:52 +01:00
Anthony J. Bentley
16397b8d9b common: convert to standard stat()/fstat() interfaces
Most modern Unix environments use 64-bit off_t by default: OpenBSD,
FreeBSD, OS X, and Linux libc implementations such as Musl.

glibc is the lone exception; it can default to 32 bits but this is
configurable by setting _FILE_OFFSET_BITS.

Avoiding the stat64()/fstat64() interfaces is desirable because they
are nonstandard and not implemented on many systems (including
OpenBSD and FreeBSD), and using 64 bits for stat()/fstat() is either
the default or trivial to set up.
2016-10-27 23:28:30 +00:00
Jan Beich
2515d83081 common: stat64 is non-standard, hide on a random Unix
src/common/file_util.cpp:79:19: error: variable has incomplete type 'struct stat64'
    struct stat64 file_info;
                  ^
src/common/file_util.cpp:79:12: note: forward declaration of 'stat64'
    struct stat64 file_info;
           ^
src/common/file_util.cpp:99:19: error: variable has incomplete type 'struct stat64'
    struct stat64 file_info;
                  ^
src/common/file_util.cpp:99:12: note: forward declaration of 'stat64'
    struct stat64 file_info;
           ^
src/common/file_util.cpp:342:19: error: variable has incomplete type 'struct stat64'
    struct stat64 buf;
                  ^
src/common/file_util.cpp:342:12: note: forward declaration of 'stat64'
    struct stat64 buf;
           ^
src/common/file_util.cpp:359:19: error: variable has incomplete type 'struct stat64'
    struct stat64 buf;
                  ^
src/common/file_util.cpp:359:12: note: forward declaration of 'stat64'
    struct stat64 buf;
           ^
4 errors generated.
2016-10-27 23:28:29 +00:00
Yuri Kunde Schlesner
3523ab7659 Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07:00
Yuri Kunde Schlesner
45751915a0 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
e4393f7ff2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00