Commit graph

145 commits

Author SHA1 Message Date
Le Philousophe
fdd11d0714 BACKENDS: FS: Implement atomic file write for stdio stream backend
This implementation creates a temporary file (suffixed with .tmp) and
renames it to the expected file name when the file is closed.
If the renaming fails, the destination file is removed and renaming is
tried again to handle cases where renaming over an existing file is not
supported by the underlying OS.
2024-10-15 22:45:50 +02:00
Le Philousophe
e61dac6c68 BACKENDS: Allow write streams to be created atomically
When creating an atomic write stream, the file is only created once it
is closed.
This can be done using a temporary file.
This commit only adds the API but not the proper implementation.
2024-10-15 22:45:50 +02:00
Le Philousophe
5d0d6b7379 BACKENDS: FS: Refactor StdioStream::makeFromPath
This allows to avoid code duplication with PosixIoStream
2024-10-01 22:43:38 +02:00
Cameron Cawley
4fdd1f7cc0 CONFIGURE: Check if fopen64 is available before using it 2024-01-08 16:23:00 +02:00
elasota
9892bedc61 COMMON: Add createReadStreamForAltStream to open Mac resource fork and metadata streams 2023-08-30 00:31:00 +02:00
Le Philousophe
0fdf53f984 ANDROID: Remove platform specific code from shared code 2023-01-20 14:14:03 +01:00
Donovan Watteau
0eb9ca84de BACKENDS: Make StdioStream use a 64-bit fseeko/ftello on more platforms
Note that using fseeko64() means that fopen64() should be used instead.
2022-12-11 21:48:33 +01:00
Le Philousophe
7c657796f4 POSIX: Don't use unsafe strcat and strcpy
It was commented but still
2022-10-23 22:46:19 +02:00
Le Philousophe
337ec7f6d9 VITA: Fix build with latest toolchains
This whole workaround may be unnecessary though as mkdir seems to be
implemented correctly on lastest Vita toolchain.
2022-06-01 12:45:29 +02:00
Antoniou Athanasios
3ee5a99619 ANDROID: More safeguards against empty path in browser 2022-03-02 14:29:56 +02:00
Thunderforge
fd129ebc0c JANITORIAL: "Mac OS X" and "OS X" to "macOS" in comments
Apple's desktop operating system was formerly called "Mac OS X" and "OS X", but since 2016 it has been called "macOS" (starting with version 10.12).

Changing across all comments and documentation to use this current terminology, except in cases where the historical versions are explicitly referenced. No code changes are made; we should consider changing those in future PRs.
2022-01-29 14:15:05 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh
b11c5ace90 BACKENDS: JANITORIAL: Remove 'virtual' when override is specified 2021-11-14 14:31:41 +02:00
SupSuper
8c86319923 BACKENDS: Use U32String for FSNode::getDisplayName 2021-08-23 21:22:27 +01:00
Cameron Cawley
423f4cce6b BACKENDS: Add override and final keywords 2021-08-12 15:16:48 +01:00
Paul Gilbert
9db14ee109 BACKENDS: Update all the backends to support SeekableWriteStream 2021-08-08 18:13:30 -07:00
antoniou
4ac31d5481 ANDROID: Use SAF if a directory is not writeable 2021-08-01 16:10:54 +03:00
Paul Gilbert
005561d305 COMMON: Increase Stream pos, seek, size from int32 to int64 2021-07-08 18:24:28 -07:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
Cameron Cawley
28086f4f8a DS: Replace outdated filesystem code 2021-02-04 01:59:14 +01:00
antoniou
8fe6aae59e ANDROID: Use SAF for folder and file creation when normal way fails
Should affect only external "secondary" storage (eg. physical SD card)
2020-11-01 19:38:07 +02:00
Bastien Bouclet
1c5f923083 PSP2: Simplify the filesystem code
The Vita SDK gained support for dirent at the end of 2017. There is no
need to have our own version anymore.

DrivesPOSIXFilesystemFactory allows to specify the contents of the
pseudo-root file system node. There is no need to hardcode them in
posix-fs.cpp anymore.
2020-09-15 07:13:00 +02:00
Thanasis Antoniou
0357293897 ANDROID: Fix crash due to adding '.' folder in SearchManager 2019-12-16 22:59:10 +02:00
Bastien Bouclet
f8d551803c POSIX: Use fstat instead of fseek / ftell to retrieve file stream sizes
fstat is generally faster as is does not cause the IO buffer to be
invalidated / refilled.

Benchmark results for the startup time of the SCI engine with Gabriel
Knight 1 CD:
- Linux, glibc, spinning HDD, fseek/ftell: 140 ms
- Linux, glibc, spinning HDD, fstat: 100 ms
- 3DS, newlib, SD card, fseek/ftell: 68 s
- 3DS, newlib, SD card, fstat: 11 s
2019-11-20 20:54:23 +01:00
Thanasis Antoniou
3e9504856f ANDROID: Override UTF-8 compliant definition of vsn_printf
This sets Android as a non-standard port in configure in order to override the definition for vsn_printf

The vsn_printf implementation is taken from https://github.com/weiss/c99-snprintf
2019-11-12 20:01:43 +02:00
Bastien Bouclet
8fb57967d7 3DS: Avoid stat calls in DrivePOSIXFilesystemNode 2019-10-31 21:35:41 +01:00
Eugene Sandulenko
23211392c0 ANDROID: Use external storage enumerator for the root directory 2019-09-27 00:22:20 +02:00
Cameron Cawley
66ef50cfeb BACKENDS: Rename and simplify AbstractFSNode::create() 2019-08-06 07:17:29 +03:00
Thierry Crozat
bfa1f392f7 POSIX: Fix missing expansion of "~" to home when it has no suffix
This fixes bug #10941: Tilde in save path creates "~" folder
2019-07-14 22:11:20 +01:00
Cameron Cawley
04229fd70b
POSIX: Clean up formatting 2019-04-28 15:06:31 +01:00
Cameron Cawley
ab0fab9bf9 POSIX: Move implementation of exists, isReadable and isWritable into posix-fs.cpp 2019-04-16 00:55:43 +03:00
Cameron Cawley
6e40b64eb1 POSIX: Allow forbidden symbols required by FreeMiNT 2018-08-18 14:08:40 +02:00
rsn8887
a4fe03c0a5 PSP2: allow loading games from uma0: in addition to ux0: 2018-03-28 23:01:01 -05:00
cpasjuste
70988527c6 PSP2: Add Playstation Vita (PSP2) support 2017-03-04 15:42:19 -06:00
D G Turner
adbf18abca BACKENDS: Fix Shadowing Compiler Warning for isDirectory symbol.
This should ensure that any future cut-and-paste for new backends do not
repeat this same warning issue.
2017-01-12 08:22:40 +00:00
Eugene Sandulenko
355c4fa646 JANITORIAL: Remove more trailing spaces 2016-10-09 15:02:02 +02:00
Willem Jan Palenstijn
fb592a0dbd BACKENDS: Rename variable shadowing function 2016-08-30 21:53:21 +02:00
Bastien Bouclet
b00cb955d9 BACKENDS: Use open instead of creat to create files
creat is not defined on the PS3. Also close the file descriptor.
2016-08-30 21:19:59 +02:00
Eugene Sandulenko
cdf30e9d58 CLOUD: Fix posix backend compilation 2016-08-24 16:07:55 +06:00
Alexander Tkachev
ae8e7f39f5 CLOUD: Make download() create necessary directories
DumpFile::open() with createPath=true create would create the missing
directories from the path before opening a file. Thus, one can easily
create a file and avoid "can't open a file" error.
2016-08-24 16:07:55 +06:00
Johannes Schickel
2622cded72 POSIX: Move assureDirectoryExists to posix-fs{.h,.cpp}. 2016-02-02 09:16:40 +01:00
Johannes Schickel
d8202baadd POSIX: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Bastien Bouclet
11cfa0d357 PS3: Initial version of the PlayStation 3 backend 2011-06-22 19:51:02 +02:00
Joost Peters
265e03c975 IRIX: Fix compilation 2011-06-04 16:55:58 +02:00
Max Horn
39076ef972 BUILD: Rename UNIX #define to POSIX 2011-05-25 13:23:03 +02:00
Max Horn
6f6051a9e1 COMMON: Mark more symbols as forbidden 2011-05-23 19:12:26 +02:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Max Horn
7a0c64631d MACOSX: Try to fix compile errors triggered with certain Mac OS X SDK versions 2011-05-03 18:25:30 +02:00
Max Horn
2fa63ca015 COMMON: Forbid use of getcwd&getwd; add macro to enable unistd.h compatibility 2011-05-03 14:30:25 +02:00
Max Horn
f62fd4f25f BACKENDS: Avoid #including .cpp files
So far, the various *-fs-factory.cpp files were #including the
corresponding *-fs.cpp files. This is surprising and hence could lead to
all kinds of problems). To fix this, provide proper headers for the
*-fs.cpp files.
This also makes code reuse via subclassing possible.

Since not all ports were tested, this will likely lead to a few
easy to fix compile regressions.
2011-05-03 13:22:00 +02:00