Commit graph

123 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
sluicebox
0887df6b39 WIN32: Fix memory leak in WindowsFilesystemNode
20 years old: be58f22feb
2024-09-18 01:06:59 -07:00
Le Philousophe
43997e2911 WIN32: Don't use unsafe sprintf and vsprintf 2022-10-23 22:46:19 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh
44219dfa1a BACKENDS: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02: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
Carlo Bramini
f44e87dfb7
WIN32: Remove F_OK/R_OK/W_OK hack (#3265)
In backends/fs/windows/windows-fs.cpp, the macros F_OK/R_OK/W_OK are not defined by system includes of MSVC, so they have been added manually into the code.
While this solution works, in my opinion it would be much cleaner to use GetFileAttributes() for getting this information.
Actually, this is what the _access()/_waccess() functions do and, afterall, this is a piece of code expected to work on Windows only.
2021-08-13 21:58:01 +03:00
Paul Gilbert
9db14ee109 BACKENDS: Update all the backends to support SeekableWriteStream 2021-08-08 18:13:30 -07:00
sluicebox
fbf16c5a58 WIN32: Make WindowsFilesystemNode UNICODE compatible 2021-06-29 12:38:01 -05:00
Cameron Cawley
5c255b3aa9 WIN32: Add override and final keywords 2020-10-16 18:32:08 +01:00
Cameron Cawley
f2b9f7bb76 BACKENDS: Remove the Windows CE port 2019-11-17 22:33:56 +01:00
Alexander Tkachev
d488e1dd55 Revert "WIN32: Fix getting the parent directory of non-existant file nodes" 2019-09-16 13:15:23 +02:00
Cameron Cawley
e55e429353 WIN32: Fix getting the parent directory of non-existant file nodes 2019-09-14 19:56:43 +03:00
Cameron Cawley
66ef50cfeb BACKENDS: Rename and simplify AbstractFSNode::create() 2019-08-06 07:17:29 +03:00
SupSuper
1d412701d1 WIN32: Always include windows.h before util.h
This avoids Windows trying to stomp our definition of ARRAYSIZE
2018-12-17 12:28:33 +02:00
SupSuper
d0512db25c WIN32: Move all ARRAYSIZE undefs to util.h
Instead of trying to undefine ARRAYSIZE everywhere we use a Windows header, let's just do it before we define our own
2018-12-17 12:28:33 +02:00
D G Turner
4dc175a4c2 WIN32: Fix Variable Shadowing Compiler Warnings.
These are emitted when using the MinGW compiler.
2017-01-12 05:44:50 +00: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
449ea100d9 WIN32: Make GPL headers consistent in themselves. 2014-02-18 02:39:40 +01:00
Tarek Soliman
a4798602d7 JANITORIAL: Fix missing whitespace in pointer cast
find -name '*.h' -or -name '*.cpp' | xargs sed -r -i 's@\(([A-Za-z0-9]+)\*\)@(\1 *)@g'

This seems to have caught some params as well which is not undesirable IMO.
It also caught some strings containing this which is undesirable so I
excluded them manually. (engines/sci/engine/kernel_tables.h)
2012-02-15 10:07:10 -06:00
Littleboy
2d2ee68d2d BACKENDS: Update WindowsFilesystemNode::getChildren() to honor the hidden parameter (FR #1726611)
Hidden folders (such as the recycle bin or temporary hidden folders) will no longer be visible in the file/folder browser (as is the case on the Posix and related backends)
2011-06-28 01:58:09 -04:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +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
Max Horn
4bed2b3ff5 SDL: Trying to cleanup the FORBIDDEN_SYMBOL situation
svn-id: r54575
2010-11-29 16:35:29 +00:00
Max Horn
917c4b00cb WINDOWS: Enable use of forbidden symbols
svn-id: r53972
2010-10-31 00:14:59 +00:00
Max Horn
8f16458e9b Renamed FSNode::openForReading / openForWriting to createReadStream / createWriteStream, again to make ownership of the returned stream clear
svn-id: r36014
2009-01-23 03:41:36 +00:00
Filippos Karapetis
88ac9b5a9b Silenced warning about redefinition of ARRAYSIZE under Windows, after the latest FS changes
svn-id: r35583
2008-12-27 20:21:55 +00:00
Travis Howell
df9a1baadc Fix regressions in HE games, when slashes are used in filenames for file opcodes.
svn-id: r35105
2008-11-17 11:09:57 +00:00
Max Horn
c7fde102e3 Renamed FilesystemNode -> FSNode
svn-id: r34716
2008-10-02 16:58:59 +00:00
Max Horn
7f18aaf8ec Pushed AbstractFilesystemNode::openForReading() / openForWriting() impls out to backends
svn-id: r34304
2008-09-03 12:56:46 +00:00
Max Horn
531bcf847c Moved FilesystemNode / FSList to namespace Common; also got rid of some 'typedef Common::String String;' name aliases
svn-id: r34302
2008-09-03 11:22:51 +00:00
Filippos Karapetis
9691562987 Cleanup
svn-id: r34295
2008-09-03 09:03:21 +00:00
Max Horn
cb21c25e41 FSNode code: Merged most versions of lastPathComponent() into one new AbstractFilesystemNode::lastPathComponent() method, with customizable path separator character
svn-id: r34197
2008-08-27 20:31:22 +00:00
Max Horn
b727ac880d Turned Windows, AmigaOS and POSIX FSFactories into plain classes; no need for them to be singletons (actually true for all other FS factories)
svn-id: r34098
2008-08-22 11:36:47 +00:00
Max Horn
8a84e3a46f cleanup
svn-id: r33847
2008-08-13 20:37:54 +00:00
Travis Howell
a9bef1051e Remove file attribute check, since getChild() can be called on file path that doesn'r exist.
svn-id: r33633
2008-08-05 11:42:04 +00:00
Nicola Mettifogo
b0e2cd5967 Fixed constructor for WindowsFilesystemNode. On Windows, trailing slashes can be added only to directory names.
svn-id: r33350
2008-07-28 02:56:17 +00:00
Max Horn
5c99d45d9f Don't #include the FS factory implementations in common/system.cpp; rather, rely on the build system to include them
svn-id: r30957
2008-02-24 23:14:04 +00:00
Filippos Karapetis
dbba13a7ac Stop redefinitions of ARRAYSIZE
svn-id: r30954
2008-02-24 15:00:28 +00:00
Max Horn
80d55b0388 Renamed AbstractFilesystemFactory to FilesystemFactory
svn-id: r30935
2008-02-23 19:01:12 +00:00
Jordi Vilalta Prat
d6c34bdc4b Fixed the spaces before tabs.
svn-id: r30667
2008-01-28 00:14:17 +00:00
Jordi Vilalta Prat
66e9d4f5e8 Removed trailing spaces.
svn-id: r30664
2008-01-27 19:47:41 +00:00
Kostas Nakos
371cc6deda make sure our GetCurrentDirectory is used (non existant in ce api)
svn-id: r29300
2007-10-28 17:59:14 +00:00
David Corrales
aba30d7ea8 Commit of patch #1804861. It implements a static lastPathComponent() function in each backend, used to extract the last path component of a given path, returned by getName().
svn-id: r29159
2007-10-07 00:28:38 +00:00
Gregory Montoir
61a642b1cc fixed savepath files listing under win32
svn-id: r29113
2007-09-27 20:39:06 +00:00
Nicola Mettifogo
258901bab9 Merged common/stdafx.h into common/scummsys.h. All referencing files have been updated.
svn-id: r28966
2007-09-19 08:40:12 +00:00
Filippos Karapetis
d6dbb98bc9 Fixed compilation under MSVC8
svn-id: r28951
2007-09-18 23:05:33 +00:00
Max Horn
ab8997f64d Fix linker issues when doing a plugin build, and (hopefully) also on Windows
svn-id: r28950
2007-09-18 21:34:57 +00:00