Commit Graph

89 Commits

Author SHA1 Message Date
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
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
Yuri Kunde Schlesner
0e23caf9fd Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot
7e8d205414 Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Emmanuel Gil Peyrot
2cdced1c51 Common: readdir_r() is deprecated, switch to readdir(). 2016-09-13 22:11:23 +09:00
Yuri Kunde Schlesner
3c56749bf9 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
13ee41dcff 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
Lioncash
dc210b6498 file_util: Don't expose IOFile internals through the API 2016-04-13 20:17:17 -04:00
LFsWang
26fb25e106 remove debug code 2016-03-31 20:29:39 +08:00
LFsWang
04990e5614 fix unicode url problem on windows 2016-03-31 19:21:03 +08:00
LFsWang
9ad1f457de Fix encode problem On Windows 2016-03-31 18:58:37 +08:00
Subv
155cba90f3 DiskDirectory: Initialize the directory member with valid info. 2016-01-16 09:30:29 -05:00