Commit graph

94 commits

Author SHA1 Message Date
Zach Hilman
b10c0d291f Remove files that are not used 2018-08-01 00:16:54 -04:00
Zach Hilman
bd410ce242 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
349e7974a5 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
861405d6c0 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
0605fbbfeb Merge pull request #765 from lioncash/file
file_util: Remove goto usages from Copy()
2018-07-22 00:03:35 -07:00
Lioncash
5440a4a9d9 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
574be087d4 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
2684cc586e 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
6602b23676 Merge pull request #759 from lioncash/redundant
file_util: Remove redundant duplicate return in GetPathWithoutTop()
2018-07-21 18:50:38 -07:00
Lioncash
85ca923ed4 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
478a19a774 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
32dde02a89 file_util: Remove redundant duplicate return in GetPathWithoutTop() 2018-07-21 15:18:23 -04:00
Lioncash
ba015f825f 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
82150bd5c1 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
0c22a8d514 Revert "Virtual Filesystem (#597)"
This reverts commit 12e9522b32.
2018-07-07 20:24:51 -07:00
bunnei
c754485cda Merge pull request #630 from FearlessTobi/remove-citra-references
Remove some references to Citra
2018-07-06 11:13:50 -04:00
Zach Hilman
12e9522b32 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
08acefbaab Remove some references to Citra 2018-07-06 15:47:06 +02:00
James Rowe
7af1a786d5 Add configurable logging backends 2018-07-02 21:45:47 -04:00
James Rowe
d74d2a77cb Update clang format 2018-07-02 21:45:47 -04:00
James Rowe
e159c550d8 Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
Lioncash
22b7e4fcf6 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
324ee31fc3 general: Convert assertion macros over to be fmt-compatible 2018-04-27 10:04:02 -04:00
Lioncash
f4cc29c07c common: Move logging macros over to new fmt-capable macros where applicable 2018-04-26 20:09:58 -04:00
James Rowe
ea88c44eb8 Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
wwylele
f1b8adf818 file_util: Log when using local user directory 2017-03-11 18:31:17 +02:00
wwylele
0ca9e1d4b0 file_util: lower logging level for harmless cases 2017-03-08 17:42:10 +02:00
noah the goodra
8477e269c3 file_util: Fixed implicit type conversion warning (#2503) 2017-01-30 20:08:00 -08:00
wwylele
2c0bde2fb7 file_util: fix missing sysdata path 2016-12-23 22:19:14 +02:00
bunnei
b2fcbaedf4 file_util: Remove unused paths. 2016-12-21 23:29:12 -05:00
Jeffrey Pfau
12cca651ce Common: Fix gcc build on macOS 2016-12-13 10:20:33 -08:00
freiro
662d907aa7 WINVER definition moved to CMake and cleanup 2016-11-30 15:47:09 +01:00
freiro
0459aadcb5 Removed /user/ from path 2016-11-26 01:00:52 +01:00
freiro
f25ecd351d Switch to AppData/Roaming 2016-11-24 16:42:31 +01:00
freiro
a3d3f96af9 Return by value and other fixes 2016-11-19 15:50:16 +01:00
freiro
92977a28a8 Win32 move default user folder location to AppData 2016-11-19 15:49:52 +01:00
Anthony J. Bentley
f78b6cd433 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
dbc84319b8 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
32bddfa1f5 Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07:00
Yuri Kunde Schlesner
fa5d9d8266 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
1138ec0d49 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
Yuri Kunde Schlesner
1e4a5da9f4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot
628ed4376a Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Emmanuel Gil Peyrot
721bb69d6e Common: readdir_r() is deprecated, switch to readdir(). 2016-09-13 22:11:23 +09:00
Yuri Kunde Schlesner
8e468474ab Fix recursive scanning of directories
ForeachDirectoryEntry didn't actually do anything with the `recursive`
parameter, and the corresponding callback parameter was shadowing the
actual recursion counters in the user functions.
2016-06-19 00:12:15 -07:00
Emmanuel Gil Peyrot
97e8c6c845 Common: Make recursive FileUtil functions take a maximum recursion
Fixes #1115.

Also improves the performances of DiskArchive’s directory
implementation a lot, simply by not going through the entire tree
instead of just listing the first level files.

Thanks to JayRoxFox for rebasing this on current master!
2016-05-21 16:41:02 +01:00
bunnei
af0f444b5a Merge pull request #1672 from wwylele/win-driver-fix
Fix driver root identification on Windows
2016-04-19 17:40:13 -04:00
wwylele
1656473b42 fix driver root identification on Windows 2016-04-15 14:50:34 +03:00
Lioncash
9b38494bcd file_util: In-class initialize data members 2016-04-13 20:17:24 -04:00
Lioncash
6c42d6bce9 file_util: const qualify IOFile's Tell and GetSize functions 2016-04-13 20:17:23 -04:00