mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 19:01:02 +00:00
Keep the Sweep Out of the Write Helper and Honour a Read-Only Target
Sweeping the target's directory from inside write_file_atomically() made every settings export into a user's folder delete their own numbered files that matched the older config temporary form, and cost a directory walk per save. The helper writes its target and nothing else; the user preset scan, the bundle metadata reads and AppConfig::load() sweep the directories the application owns, once, while they hold the lock. Replacing a file needs only a writable directory, so a preset or config the user made read-only was overwritten where the in-place write used to fail; such a target is refused before anything is written. The CLI's load_if_exists() takes no lock and creates no lock file, since the CLI never saves. The lock guard holds the slot mutex through a unique_lock, so an exception during construction cannot leave the slot locked for good, and it counts its entry last so a throw leaves the slot as found; the cool-down after a failed open is set where the failure is seen. The cloud agent's sync state and secret fallback file and the 3DPrinterOS session file wrote through a fixed ".tmp" name with a non-Unicode stream; they call the helper. The vendor cache failure test makes the cache read-only, which the helper refuses on every platform, and the utility tests carry the PascalCase tag the test rules ask for.
This commit is contained in:
@@ -121,8 +121,9 @@ public:
|
||||
|
||||
// Load the slic3r.ini from a user profile directory (or a datadir, if configured).
|
||||
// Return an error string, or an empty string on success.
|
||||
std::string load();
|
||||
std::string load(bool read_only = false);
|
||||
// Treat a missing config as default state; otherwise load it normally.
|
||||
// The CLI's load: it never saves, so it takes no lock and creates no lock file.
|
||||
std::string load_if_exists();
|
||||
// Store the slic3r.ini into a user profile directory (or a datadir, if configured).
|
||||
void save();
|
||||
|
||||
Reference in New Issue
Block a user