Commit Graph

133 Commits

Author SHA1 Message Date
Ben d5333c37de
Merge pull request #4033 from zhaowenlan1779/port-yuzu-764
Port "file_util: Minor changes to ScanDirectoryTree() and ForeachDirectoryEntry()" from yuzu
2018-07-30 13:51:21 +02:00
Merry c4c158c6b6
Merge pull request #4036 from zhaowenlan1779/port-yuzu-705
Port "file_util: return string by const reference for GetExeDirectory()" from yuzu
2018-07-30 12:10:35 +01:00
Lioncash 99b2a871a7 file_util: return string by const reference for GetExeDirectory()
This disallows modifying the internal string buffer (which shouldn't be
modified anyhow).
2018-07-30 16:55:55 +08:00
Lioncash df5069f8c0 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-30 16:19:03 +08:00
Lioncash cc6cb45536 file_util: std::move FST entries in ScanDirectoryTree()
Avoids unnecessary copies when building up the FST entries.
2018-07-30 16:16:58 +08:00
Lioncash d3a52e45e3 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-30 08:48:58 +08:00
wwylele 0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
wwylele 7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
Daniel Lim Wee Soong 51398e0301 Logging: Add customizable logging backends and fmtlib based macros
* Change the logging backend to support multiple sinks through the
Backend Interface
* Add a new set of logging macros to use fmtlib instead.
* Qt: Compile as GUI application on windows to make the console hidden by
default. Add filter configuration and a button to open log location.
* SDL: Migrate to the new logging macros
2018-04-23 21:32:56 -06:00
wwylele 39fce60145 [quick-fix]file-util: fmtlib errors on FILE* type parameter. Explicitly cast it to void* 2018-04-06 13:35:37 +03:00
Daniel Lim Wee Soong 0f4c9c9f47 file_util: Remove long long casting on buf.st_size in NGLOG statement 2018-03-27 23:31:08 +08:00
Daniel Lim Wee Soong 968569aa61 Replace format specifiers for all usages of ASSERT_MSG 2018-03-27 23:28:42 +08:00
Daniel Lim Wee Soong 111da6db06 common: Migrate logging macros
Follow-up of #3533

Replace logging to use NGLOG instead of LOG

This is significantly larger than the previous ones.
2018-03-25 18:42:50 +08:00
James Rowe f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
wwylele d040a73bed file_util: Log when using local user directory 2017-03-11 18:31:17 +02:00
wwylele 7cd6cc0fd9 file_util: lower logging level for harmless cases 2017-03-08 17:42:10 +02:00
noah the goodra a2d0e2d807 file_util: Fixed implicit type conversion warning (#2503) 2017-01-30 20:08:00 -08:00
wwylele 488b7a4041 file_util: fix missing sysdata path 2016-12-23 22:19:14 +02:00
bunnei 707cc66362 file_util: Remove unused paths. 2016-12-21 23:29:12 -05:00
Jeffrey Pfau fb952c399e Common: Fix gcc build on macOS 2016-12-13 10:20:33 -08:00
freiro 0c22e52f52 WINVER definition moved to CMake and cleanup 2016-11-30 15:47:09 +01:00
freiro 972b289c78 Removed /user/ from path 2016-11-26 01:00:52 +01:00
freiro 79317b63d9 Switch to AppData/Roaming 2016-11-24 16:42:31 +01:00
freiro 3d75e3cd07 Return by value and other fixes 2016-11-19 15:50:16 +01:00
freiro 29bb82cb8e Win32 move default user folder location to AppData 2016-11-19 15:49:52 +01:00
Anthony J. Bentley 26af2b644c 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 51f92f0e4e 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 f120e78b56 Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07:00
Yuri Kunde Schlesner 84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot ebdae19fd2 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 396a8d91a4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Emmanuel Gil Peyrot 519e7013be Common: readdir_r() is deprecated, switch to readdir(). 2016-09-13 22:11:23 +09:00
Yuri Kunde Schlesner d6792632f0 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 8ab6f26c09 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 6d29c20208 Merge pull request #1672 from wwylele/win-driver-fix
Fix driver root identification on Windows
2016-04-19 17:40:13 -04:00
wwylele 43b6cbd762 fix driver root identification on Windows 2016-04-15 14:50:34 +03:00
Lioncash 5f51622e9d file_util: In-class initialize data members 2016-04-13 20:17:24 -04:00
Lioncash 655623ebb2 file_util: const qualify IOFile's Tell and GetSize functions 2016-04-13 20:17:23 -04:00
Lioncash a4120ca66c file_util: Don't expose IOFile internals through the API 2016-04-13 20:17:17 -04:00
LFsWang 87afef73b1 remove debug code 2016-03-31 20:29:39 +08:00
LFsWang be01912539 fix unicode url problem on windows 2016-03-31 19:21:03 +08:00
LFsWang acfa76aa38 Fix encode problem On Windows 2016-03-31 18:58:37 +08:00
Subv 922b31ebbd DiskDirectory: Initialize the directory member with valid info. 2016-01-16 09:30:29 -05:00
LFsWang 8376821776 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 b3cfcf55ea 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 11a64acf23 Merge pull request #1095 from archshift/game-list
Initial implementation of a game list
2015-10-01 23:35:19 -04:00
archshift 7134a17fc6 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 751fbfdcc3 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
Emmanuel Gil Peyrot b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner f3c096951b Common: Move IO-specific compatibility macros to file_util.cpp 2015-05-07 15:45:20 -03:00
Yuri Kunde Schlesner bf12f270b3 Common: Remove many unnecessary cross-platform compatibility macros 2015-05-06 23:50:08 -03:00
Emmanuel Gil Peyrot 129ad721c1 Common: Switch to the XDG Base Directory Specification for directory selection.
This allows for easily movable and independent configuration and data directories, using standardized paths.
2015-02-25 05:27:13 +01:00
Emmanuel Gil Peyrot 54d6f6c82b Common: Change names containing “Dolphin” or “PPSSPP” to something more generic. 2015-02-20 16:54:10 +00:00
Subv 71a063f45c Archives: Changed the way paths are built for the archives.
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
2015-01-03 20:46:05 -05:00
Subv 3bc9f5509b Archives: Change the folder layout of some archives.
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
2015-01-02 21:55:13 -05:00
Subv aade417b14 Archives: Reduced duplicate code in RomFS and SaveCheck.
Fixed a few warnings and cleaned up the code
2015-01-02 21:13:54 -05:00
Subv 2c89d4d5cd Archives: Implemented ExtSaveData and SharedExtSaveData
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.
2014-12-29 22:29:55 -05:00
purpasmart96 ebfd831ccb License change 2014-12-20 21:20:24 -08:00
Subv bec527fa24 SaveData: Implemented the SystemSaveData archive.
It will be stored in the /syssavedata folder. This archive is user by various Services and possibly games via the FS:U service.
2014-12-17 23:44:32 -05:00
Subv ea9ce0fba7 Filesystem/Archives: Implemented the SaveData archive
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
2014-12-17 19:21:38 -05:00
Yuri Kunde Schlesner 0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
bunnei 5bac72282a Common: Add "sysdata" to GetUserPath and cleanup. 2014-12-12 00:15:47 -05:00
Rohit Nirmal 8a62423970 Change NULLs to nullptrs. 2014-12-03 12:57:57 -06:00
Emmanuel Gil Peyrot f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
bunnei ce8390ac03 Merge pull request #133 from archshift/sdmc-enabled
Use config files to store whether SDMC is enabled or not, auto-create SDMC dir.
2014-10-23 18:51:54 -04:00
Yuri Kunde Schlesner b75ac24391 Use std sized types instead of platform specific typedefs 2014-10-22 22:43:15 -02:00
archshift a7c7946867 Common: Return from CreateFullPath early if the directory creation fails 2014-10-22 15:24:25 -07:00
bunnei a171000cbe Merge pull request #108 from archshift/config
Configuration files
2014-10-07 19:44:13 -04:00
archshift e6594f9f53 Added configuration file system.
Uses QSettings on citra-qt, and inih on citra-cli.
2014-10-07 15:09:37 -07:00
Emmanuel Gil Peyrot fbd72fd6bf Common: Add a helper function to generate a 8.3 filename from a long one.
Core: Fix the SDMC Directory implementation to make blargSnes work.
2014-10-06 19:58:43 +02:00
Lioncash ca2f0de08a Fix warnings in core and common 2014-09-28 11:44:14 -04:00
archshift 1966f7b0ad Use the citra user path for the sdmc directory 2014-09-21 09:34:33 -07:00
Emmanuel Gil Peyrot 6b7b36a874 Common: Rename the File namespace to FileUtil, to match the filename and prevent collisions. 2014-09-17 14:35:45 +00:00
bunnei 532a9e80a0 Merge pull request #99 from archshift/ext-check
loader.cpp: improved file extension checking, made Upper/LowerStr useful, moved string_util into Common namespace
2014-09-11 00:04:36 -04:00
archshift 9d7cc2bedc common: Prune all redundant includes 2014-09-08 17:25:43 -07:00
archshift 5472fd4d9b Added string_util to common, small changes in loader.cpp 2014-09-08 15:43:22 -07:00
Lioncash da6f24b374 Common: Move remaining C header includes over to their C++ equivalent 2014-08-17 13:54:06 -04:00
bunnei 7a136b8a84 fixes to build on linux 2014-04-22 19:42:29 -07:00
bunnei de0a034a84 fixed project includes to use new directory structure 2014-04-08 20:15:08 -04:00
bunnei 63e46abdb8 got rid of 'src' folders in each sub-project 2014-04-08 19:25:03 -04:00