#include <cstddef>
#include <filesystem>
#include <iosfwd>
#include <string>
#include <string_view>
◆ DocumentSaveStatus
Result category for saving an SVG source file.
| Enumerator |
|---|
| Ok | The source was written successfully.
|
| OpenFailed | The destination could not be opened.
|
| WriteFailed | The full source could not be written.
|
| CloseFailed | Closing the file descriptor failed after writing.
|
◆ SaveSourceToPath()
| DocumentSaveResult donner::editor::SaveSourceToPath |
( |
const std::filesystem::path & | path, |
|
|
std::string_view | source ) |
|
nodiscard |
Write SVG source bytes to path without following symlinks.
Existing destinations are opened with O_NOFOLLOW; missing destinations are created with O_CREAT | O_EXCL. The function intentionally does not pre-stat the path, avoiding a TOCTOU window between inspection and open.
- Parameters
-
| path | Destination file path. |
| source | SVG source bytes to persist. |
- Returns
- Save status, including errno and a diagnostic message on failure.