Commit Graph

64 Commits

Author SHA1 Message Date
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
JosJuice d276d1abbb Fix VolumeDirectory
Fixes the regression from a225426 and clarifies a related comment.
2015-08-26 19:21:09 +02:00
Admiral H. Curtiss df70f50fdf GetExeDirectory() shouldn't return paths with /../ in the middle. 2015-06-26 23:51:40 +02:00
Jeffrey Pfau 7085fcc8d6 Fix FreeBSD build 2015-06-13 21:52:47 -07:00
comex dc91e8b607 Add a mode to use a dummy Wii NAND.
Eventually, netplay will be able to use the host's NAND, but this could
still be useful in some cases; for TAS it definitely makes sense to have
a way to avoid using any preexisting NAND.

In terms of implementation: remove D_WIIUSER_IDX, which was just WIIROOT
+ "/", as well as some other indices which are pointless to have as
separate variables rather than just using the actual path (fixed, since
they're actual Wii NAND paths) at the call site.  Then split off
D_SESSION_WIIROOT_IDX, which can point to the dummy NAND directory, from
D_WIIROOT_IDX, which always points to the "real" one the user
configured.
2015-05-28 19:14:42 -04:00
comex a0a80c9a9c Fix CopyDir to not require source and dest paths to end with "/". 2015-05-28 19:14:42 -04:00
comex a225426510 Rewrite FileSearch and improve ScanDirectoryTree.
- FileSearch is now just one function, and it converts the original glob
  into a regex on all platforms rather than relying on native Windows
  pattern matching on there and a complete hack elsewhere.  It now
  supports recursion out of the box rather than manually expanding
  into a full list of directories in multiple call sites.

  - This adds a GCC >= 4.9 dependency due to older versions having
  outright broken <regex>.  MSVC is fine with it.

- ScanDirectoryTree returns the parent entry rather than filling parts
  of it in via reference.  The count is now stored in the entry like it
  was for subdirectories.

- .glsl file search is now done with DoFileSearch.

- IOCTLV_READ_DIR now uses ScanDirectoryTree directly and sorts the
  results after replacements for better determinism.
2015-05-28 19:14:42 -04:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Lioncash b0613bb1c8 General: Apply the const specifier where applicable 2015-04-15 02:04:03 -04:00
degasus ef6bdf674f Common: Remove TLS usage in GetLastErrorMsg
Just return std::string as this code isn't performance critical.
2015-04-07 22:42:21 +02:00
Ryan Houdek 297012ddd7 Fix Wii configuration path being incorrect.
On loading the NANDRoot from the config, if it isn't set it will still attempt to be set.
So on the invalid empty path, just don't set it.
2015-03-17 21:27:40 -05:00
Ryan Houdek aaf04aeaca Fix user directories at times doing stupid things.
With my previous changes Dolphin would fail to create the user directory if it didn't exist, and would dump all the configuration options in to the cwdir.
This was a bit more complicated to fix in a clean fashion, so I took to moving around code concerning user directories.
Instead of having GetUserPath serve a dual purpose of both getting and setting our user directories, break out to a new SetUserPath function.

GetUserPath will know only get the configured user path.
SetUserPath will set our user paths and setup the internal user path state.

This ending up being a lot cleaner overall, which is nice. Also less mind bending when attempting to read the code.

So now we won't dump all of our configuration in to the cwdir if ~/.dolphin-emu isn't found.

Fixes issue 8371.
2015-03-15 09:19:48 -05:00
Ryan Houdek ca6e154f0b Fix a bug on user path re-assignment.
The Load directory wasn't being properly reassigned when the user path changed, which causes a bunch of issues with things loading from the wrong
place when using the -U option in Dolphin.
2015-02-25 05:45:25 -06:00
Ryan Houdek db06f058e4 Move user directory detection location to UICommon.
The UI should decide on where it wants the user directory, not our core system.
This is in anticipation of some upcoming work on Android which will need proper user directory setting.
2015-02-25 03:31:59 -06:00
Stevoisiak cb86db7b68 Minor consistency changes
Mostly small changes, like capitalization and spelling
2015-01-12 15:18:18 -05:00
Pierre Bourdon dad7911214 Merge pull request #1486 from rohit-n/goto
Remove some gotos.
2014-12-20 16:47:55 +01:00