Commit Graph

80 Commits

Author SHA1 Message Date
Lioncash a85aa73c4d
FileUtil: Remove unnecessary IOFile GetHandle() call in ReadFileToString()
We can just use IOFile's GetSize() function to do the same thing. While
we're at it, get rid of unnecessary variables.
2018-05-11 16:27:33 -04:00
spycrab 0170052f5d Qt: Allow custom stylesheets 2018-05-08 15:07:50 +02:00
spycrab db0e5108dc Win32/FileUtil: Fix IsDirectory() not working for certain directories 2018-05-04 23:53:41 +02:00
JosJuice 6e96f62b41 Remove code related to UI.ini
We don't use it for anything, we just create it and leave it empty.
2018-05-02 18:18:27 +02:00
Pierre Bourdon 9628333b86 AutoUpdater: support optionally restarting Dolphin after update 2018-03-23 11:10:25 +01:00
Lioncash 50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
JosJuice b3b7aef09a Android: Extract Sys to a different folder than the User folder 2017-12-26 09:53:32 +01:00
JosJuice d1c1793a34 Don't expose SYSDATA_DIR in a header 2017-12-24 17:13:04 +01:00
JosJuice 87d982982d Fix regression in File::CopyDir
This apparently fixes https://bugs.dolphin-emu.org/issues/10499 somehow.

The first changed line of this commit is just for performance - the
second changed line is where the difference in behavior is.
2017-08-25 19:14:14 +02:00
Pierre Bourdon a641609857 WFSI: Implement patch install finalization. 2017-08-22 23:41:37 +02:00
Léo Lam 6f923ffae4 FileUtil: Simplify File::Copy on non-Windows platforms
The old way of doing it is error prone and unnecessarily complex.
2017-08-21 18:31:46 +02:00
Pierre Bourdon 873521ce0b Revert "Try to fix File::Copy with non-1024-byte aligned sizes" 2017-08-21 18:29:58 +02:00
Markus Wick 8280d15357 Merge pull request #5939 from JonnyH/WIP/broken-fstream-copy
Try to fix File::Copy with non-1024-byte aligned sizes
2017-08-21 17:01:16 +02:00
Sepalani 4e5fe6366a CommonFuncs: LastStrerrorString added 2017-08-18 20:08:50 +01:00
Jonathan Hamilton 643b3ba9f8 Try to fix File::Copy with non-1024-byte aligned sizes
ifstream::read() sets the failbit if trying to read over the end, which
means that (!input) would be hit for the 'last' block if it wasn't
exactly BSIZE (1024) bytes.
2017-08-17 14:08:56 -07:00
JosJuice 5ca3aee00a FileUtil: Add a class for Exists/IsDirectory/GetSize
Some code was calling more than one of these functions in a row
(in particular, FileUtil.cpp itself did it a lot...), which is
a waste since it's possible to call stat a single time and then
read all three values from the stat struct. This commit adds a
File::FileInfo class that calls stat once on construction and
then lets Exists/IsDirectory/GetSize be executed very quickly.

The performance improvement mostly matters for functions that
can be handling a lot of files, such as File::ScanDirectoryTree.

I've also done some cleanup in code that uses these functions.
For instance, some code had checks like !Exists() || !IsDirectory(),
which is functionally equivalent to !IsDirectory(), and some
code was using File::GetSize even though there was an IOFile
object that the code could call GetSize on.
2017-06-29 19:07:29 +02:00
Léo Lam 01faa5c852 FileUtil: Use errno for printing errors in IsDirectory
stat() returns an error code in errno on both POSIX compliant
platforms and Windows.

This means we should always use errno instead of GetLastErrorMsg
which uses GetLastError() (Win32) on Windows.
2017-06-16 12:43:41 +02:00
Léo Lam aa63199977 FileUtil: Don't manually strip trailing slashes
POSIX allows one or more trailing slashes for directories.

From POSIX.1-2008, section 3.271 (Base Definitions / Pathname):

> A pathname can optionally contain one or more trailing <slash>
> characters. Multiple successive <slash> characters are considered to
> be the same as one <slash>, except for the case of exactly two
> leading <slash> characters.

On Windows, the extra trailing slashes are ignored for directories too.
2017-06-16 12:31:26 +02:00
JosJuice f09ceaa735 Move IOFile to a separate file
Reduces the number of files that need to be recompiled
when making changes to FileUtil.h.
2017-06-15 21:33:50 +02:00
Shawn Hoffman 9357cee2ef do not assign in conditional statements 2017-06-07 20:09:44 -07:00
Shawn Hoffman e1a3e41bf3 fix various instances of -1 being assigned to unsigned types 2017-06-07 19:52:07 -07:00
Ryan Houdek a2f5c3dbe0 Add some missing INI files to FileUtil 2017-02-16 09:33:50 +01:00
Chris Burgener 5224771dac Copy Wii save for current game for Netplay and TAS 2017-02-05 13:17:05 -05:00
Michael Maltese 713ec5ffd5 Add includes for building on Windows without PCH 2017-01-23 01:37:41 -08:00
Pierre Bourdon 45d27f7fc7 CommonPaths: Add D_WFSROOT_IDX.
Defaults to $USERDIR/WFS. Used to store the contents normally stored on
WFS mass storage devices.
2017-01-14 17:06:40 +01:00
Lioncash 6f08ef9a25 IOFile: Get rid of IOFile's ReleaseHandle function
Transfer of handles should be done via std::move.
2017-01-12 12:34:06 -05:00
Lioncash 045a8400e6 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.
2017-01-04 18:37:48 -05:00
Mat M 40e36ebd1e Merge pull request #4550 from linkmauve/no-readdir_r
Common: Replace deprecated readdir_r with readdir
2016-12-25 17:34:50 -05:00
JosJuice e56bec9c87 Fix outdated comments in ScanDirectoryTree 2016-12-25 21:57:33 +01:00
Emmanuel Gil Peyrot 495dfdb16c Common: Replace deprecated readdir_r with readdir
Fixes a warning under recent glibc.
2016-12-24 16:18:47 +01:00
JosJuice de355a8521 Revert "IOS HLE: Prevent accessing host file system"
This reverts commit 141f3bfb3a.
The implementation of getting absolute paths wasn't working
on non-Windows systems, which is a huge problem for IOS HLE.
2016-11-26 15:50:28 +01:00
JosJuice 141f3bfb3a IOS HLE: Prevent accessing host file system 2016-11-13 10:03:23 +01:00
shuffle2 f121fa07c2 Merge pull request #2868 from sepalani/dolphin_ssl
Dolphin new Dump SSL features
2016-10-03 06:16:49 -07:00
Anthony Serna 1a81735527 Merge pull request #3859 from Aestek/feature/netplay-md5
Netplay: add md5 testing
2016-07-18 09:20:37 -05:00
Anthony J. Bentley 5bab6210ef Use the standard stat()/fstat() interfaces, not nonstandard *64().
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-07-17 04:30:00 -06:00
Aestek 9c5b546e2e Add Wii sdcard to CommonPaths 2016-07-16 22:48:46 +02:00
Sepalani 529ca245d7 Added: more SSL features, plus SSL dump folder
Dump: rootca, peercert
2016-07-01 14:33:54 +04:00
JosJuice ed42467e87 Fall back to default theme when the configured theme doesn't exist 2016-06-30 11:49:13 +02:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Scott Mansell b2f133d2ac make DeleteDirRecursively clean up correctly after failure.
Fixes Metroid prime crashing the second boot after loading
a save state (issue 9496)
2016-04-25 18:28:38 +12:00
mathieui f15ffda5a7 Correct ampersands as well 2016-01-21 21:27:56 +01:00
mathieui 3e283ea9f1 More asterisks 2016-01-21 21:16:51 +01:00
mathieui 78aa398e7c Common: asterisks go against the type name
not the variable name
2016-01-21 20:46:25 +01:00
spxtr 2f50560602 Add support for sending game memory changes to outside processes 2015-12-29 17:59:16 -08:00
Markus Wick a498c684a2 Merge pull request #2304 from linkmauve/xdg-basedir
UICommon: Respect XDG Base Directory Specification on POSIX systems
2015-11-12 12:31:24 +01:00
Emmanuel Gil Peyrot b61da5db54 FileUtil: Move ShaderCache to the Cache directory. 2015-11-10 21:53:30 +00:00
Mathieu Comandon f2ae1a2545 Implement relocatable builds on Linux
- Change the path of the Sys folder to the executable's location
- Add LINUX_LOCAL_DEV flag to use relocatable version on Linux
- Add CMake definition for relocatable build
2015-11-10 12:49:04 -08:00
spxtr d9d6cf8eda GC controller input using named pipes
Currently only works on unix, but can be extended to other systems. Can
also be extended to do wiimotes.

Searches the Pipes folder for readable named pipes and creates a dolphin
input device out of them. Send controller inputs to the game by writing
to the file. Commands are described in Pipes.h.
2015-10-24 20:20:03 -07:00
Rohit Nirmal 3b75f45cf6 Fix building with PCH disabled. 2015-09-28 11:51:08 -05:00
Lioncash cc036ca86c Common: Remove other Common prefixed headers from Common.h 2015-09-26 18:51:58 -04:00