[Scummvm-git-logs] scummvm master -> 0e86eda0be239a6324105c1ca67cfe5ea0e0b0da

lephilousophe noreply at scummvm.org
Sun Oct 27 10:46:31 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0e86eda0be BACKENDS: FS: Fix Atari


Commit: 0e86eda0be239a6324105c1ca67cfe5ea0e0b0da
    https://github.com/scummvm/scummvm/commit/0e86eda0be239a6324105c1ca67cfe5ea0e0b0da
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-10-27T11:46:16+01:00

Commit Message:
BACKENDS: FS: Fix Atari

Atari only support 8.3 file names and adding a tmp suffix for atomic
writes breaks this.
Make the WriteMode_WriteAtomic flag available in all cases and fall back
on unatomic write in this case.

Changed paths:
    backends/fs/stdiostream.cpp
    backends/fs/stdiostream.h


diff --git a/backends/fs/stdiostream.cpp b/backends/fs/stdiostream.cpp
index 799eee41302..cc03e78321c 100644
--- a/backends/fs/stdiostream.cpp
+++ b/backends/fs/stdiostream.cpp
@@ -35,6 +35,15 @@
 #include "backends/fs/stdiostream.h"
 #include "common/textconsole.h"
 
+#if defined(__DC__)
+// libronin doesn't support rename
+#define STDIOSTREAM_NO_ATOMIC_SUPPORT
+#endif
+#if defined(ATARI)
+// Atari file names must have a 8.3 format, atomic breaks this
+#define STDIOSTREAM_NO_ATOMIC_SUPPORT
+#endif
+
 StdioStream::StdioStream(void *handle) : _handle(handle), _path(nullptr) {
 	assert(handle);
 }
@@ -164,6 +173,7 @@ StdioStream *StdioStream::makeFromPathHelper(const Common::String &path, WriteMo
 		StdioStream *(*factory)(void *handle)) {
 	Common::String tmpPath(path);
 
+	// If no atmoic support is compiled in, WriteMode_WriteAtomic must behave like WriteMode_Write
 #ifndef STDIOSTREAM_NO_ATOMIC_SUPPORT
 	// In atomic mode we create a temporary file and rename it when closing the file descriptor
 	if (writeMode == WriteMode_WriteAtomic) {
diff --git a/backends/fs/stdiostream.h b/backends/fs/stdiostream.h
index 812dfb4f157..041b6d8382d 100644
--- a/backends/fs/stdiostream.h
+++ b/backends/fs/stdiostream.h
@@ -27,19 +27,12 @@
 #include "common/stream.h"
 #include "common/str.h"
 
-#if defined(__DC__)
-// libronin doesn't support rename
-#define STDIOSTREAM_NO_ATOMIC_SUPPORT
-#endif
-
 class StdioStream : public Common::SeekableReadStream, public Common::SeekableWriteStream, public Common::NonCopyable {
 public:
 	enum WriteMode {
 		WriteMode_Read = 0,
 		WriteMode_Write = 1,
-#ifndef STDIOSTREAM_NO_ATOMIC_SUPPORT
 		WriteMode_WriteAtomic = 2,
-#endif
 	};
 
 protected:




More information about the Scummvm-git-logs mailing list