| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Cleans up common so that we can enable warnings as errors.
|
|\
| |
| | |
common: Silence two discarded result warnings
|
| |
| |
| |
| |
| |
| |
| | |
These are intentionally discarded internally, since the rest of the
public API allows querying success. We want all non-internal uses of
these functions to be explicitly checked, so we can signify that we
intentionally want to discard the return values here.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Migrates a remaining common file over to the Common namespace, making it
consistent with the rest of common files.
This also allows for high-traffic FS related code to alias the
filesystem function namespace as
namespace FS = Common::FS;
for more concise typing.
|
|
|
|
| |
Adds a screenshots directory as a path managed by FileUtil.
|
|\
| |
| | |
common/file_util: Allow access to files on network shares
|
| |
| |
| |
| |
| |
| |
| |
| | |
On Windows, network shares use paths like \\server\share\file which were
being broken by FileUtil::SanitizePath() removing double slashes.
Changed the code in SanitizePath to permit a double-backslash if it
occurs at the start of a filepath (on Windows only).
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
It's undefined behavior to pass a null pointer to std::fread and
std::fwrite, even if the length passed in is zero, so we must perform
the precondition checking ourselves.
A common case where this can occur is when passing in the data of an
empty std::vector and size, as an empty vector will typically have a
null internal buffer.
While we're at it, we can move the implementation out of line and add
debug checks against passing in nullptr to std::fread and std::fwrite.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* IOFile: Make the move constructor and move assignment operator noexcept
Certain parts of the standard library try to determine whether or not a
transfer operation should either be a copy or a move. The prevalent notion
of move constructors/assignment operators is that they should not throw,
they simply move an already existing resource somewhere else.
This is typically done with 'std::move_if_noexcept'. Like the name says,
if a type's move constructor is noexcept, then the functions retrieves an
r-value reference (for move semantics), or an l-value (for copy semantics)
if it is not noexcept.
As IOFile deletes the copy constructor and copy assignment operators,
using IOFile with certain parts of the standard library can fail in
unexcepted ways (especially when used with various container
implementations). This prevents that.
* fix various instances of -1 being assigned to unsigned types
* do not assign in conditional statements
* File/IOFile: Check _tfopen_s properly
* common/file_util.cpp: address review comments
Co-authored-by: Lioncash <mathew1800@gmail.com>
Co-authored-by: Shawn Hoffman <godisgovernment@gmail.com>
Co-authored-by: Sepalani <sepalani@hotmail.fr>
|
| |
|
|
|
|
| |
While we're at it, also invert the conditional into a guard clause.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
These are already present within the header, so they don't need to be
repeated in the cpp file.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
MinGW provides POSIX functions
|
| |
|
| |
|
|
|
|
|
| |
While still essentially being zero, we should be returning a numeric
value here, not a boolean typed value.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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&
|
|\
| |
| | |
file_util, vfs: Use std::string_view where applicable
|
| |
| |
| |
| |
| | |
Avoids unnecessary construction of std::string instances where
applicable.
|
|\ \
| |/
|/| |
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.
|
| |
| |
| |
| |
| | |
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.
|
|/
|
|
| |
Avoids unnecessary copies when building up the FST entries.
|
|\
| |
| | |
file_util: Remove redundant duplicate return in GetPathWithoutTop()
|
| |
| |
| |
| |
| | |
Given both operands are the same type, there won't be an issue with
overload selection that requires making this explicit.
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This disallows modifying the internal string buffer (which shouldn't be
modified anyhow).
|
|
|
|
|
|
|
|
|
|
| |
* Virtual Filesystem
* Fix delete bug and documentate
* Review fixes + other stuff
* Fix puyo regression
|
|
|
|
| |
This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
|
|\
| |
| | |
Remove some references to Citra
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
This makes clang-format useful on those.
Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|\
| |
| | |
Fix driver root identification on Windows
|
| | |
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
ForeachDirectoryEntry is changed by #1256 ,but return value at last line
was missing.
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
Initial implementation of a game list
|
| |
| |
| |
| |
| | |
Converted FileUtil::ScanDirectoryTree and FileUtil::DeleteDirRecursively
to use the new ScanDirectoryTreeAndCallback function internally.
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This allows for easily movable and independent configuration and data directories, using standardized paths.
|
| |
|
|
|
|
| |
Each archive now takes a mount point of either NAND or SDMC, and builds its own directory structure there, trying to simulate an HLE-friendly hardware layout
|
|
|
|
| |
This is to better represent the hardware layout, they are still aren't quite accurate, but this better and will help a bit when implementing the other archives like NAND-RO and NAND-RW
|
|
|
|
| |
Fixed a few warnings and cleaned up the code
|
|
|
|
|
|
|
|
| |
They will be stored in /extsavedata/SDMC and /extsavedata/NAND respectively.
Also redirect some APT_A functions to their APT_U equivalents.
Implemented the gamecoin.dat file in SharedExtSaveData in the PTM module.
Implemented formatting the savegame.
Retake a previous savegame if it exists instead of reporting them as not formatted every time a game is loaded.
|
| |
|
|
|
|
| |
It will be stored in the /syssavedata folder. This archive is user by various Services and possibly games via the FS:U service.
|
|
|
|
|
|
|
|
|
|
| |
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information
Got rid of the code duplication in File and Directory
Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive.
FS_U: Use the correct error code when a file wasn't found
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Use config files to store whether SDMC is enabled or not, auto-create SDMC dir.
|
| | |
|
|/ |
|
|\
| |
| | |
Configuration files
|
| |
| |
| |
| | |
Uses QSettings on citra-qt, and inih on citra-cli.
|
| |
| |
| |
| | |
Core: Fix the SDMC Directory implementation to make blargSnes work.
|
|/ |
|
| |
|
| |
|
|\
| |
| | |
loader.cpp: improved file extension checking, made Upper/LowerStr useful, moved string_util into Common namespace
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
|
|