Commit graph

83 commits

Author SHA1 Message Date
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
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
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
LFsWang
d8d9d5d916 Add missing return values in ForeachDirectoryEntry
ForeachDirectoryEntry is changed by #1256 ,but return value at last line
was missing.
2015-12-23 16:26:38 +08:00
archshift
6e66a1244e Refactor ScanDirectoryTreeAndCallback to separate errors and retvals
ScanDirectoryTreeAndCallback, before this change, coupled error/return
codes and actual return values (number of entries found). This caused
confusion and difficulty interpreting the precise way the function
worked.

Supersedes, and closes #1255.
2015-11-27 13:33:38 -08:00
bunnei
bc1663cbb8 Merge pull request #1095 from archshift/game-list
Initial implementation of a game list
2015-10-01 23:35:19 -04:00
archshift
7b96bd3136 Split up FileUtil::ScanDirectoryTree to be able to use callbacks for custom behavior
Converted FileUtil::ScanDirectoryTree and FileUtil::DeleteDirRecursively
to use the new ScanDirectoryTreeAndCallback function internally.
2015-09-30 21:04:47 -07:00
Lioncash
08147474cb general: Silence some warnings when using clang 2015-09-16 08:51:53 -04:00
Emmanuel Gil Peyrot
8cf9eb7f43 Common: Fix FileUtil includes, and everything relying on those. 2015-06-28 00:36:53 +01:00