Keep Replacing a Read-Only Config and Include What the Helpers Need Everywhere

The config was always replaced by a rename, never written in place, so
the write helper's refusal of a read-only target, right for the presets
it mirrors, stopped a read-only OrcaSlicer.conf from ever being saved
again. The helper takes an explicit opt-in to replace such a file, and
the two config save variants share one writer that uses it.

The identity helper's stat headers were included only under the Linux
guard, which the Linux-only build never noticed; they are included on
every platform now. A temporary the longer name pushes past the path
limit is written in place like one refused for permissions, the rename
retry that waits for a Windows reader runs on Windows only, a failing
stat in the sweep skips that entry rather than ending the sweep, and the
rename fallback no longer stats the target it is about to remove.
This commit is contained in:
Hanif Koh
2026-09-24 21:32:30 +08:00
parent 758b802dec
commit dda6646c49
5 changed files with 77 additions and 57 deletions
+4 -1
View File
@@ -451,7 +451,10 @@ private:
// Preset for each machine
MachineSettingMap m_printer_settings;
// Has any value been modified since the config.ini has been last saved or loaded?
// Writes the assembled config text, and on Windows its checksum and a backup copy. `checksum_source`
// is the text load() will verify, which for the JSON config ends before the trailing newline.
bool write_config_file(const std::string &path, std::string body, const std::string &checksum_source);
bool m_dirty;
// Original version found in the ini file before it was overwritten
Semver m_orig_version;