Added a private flag

This commit is contained in:
2026-08-09 14:16:18 +02:00
parent a9f1f9b7b6
commit f8349e9a11
5 changed files with 52 additions and 9 deletions
+12 -1
View File
@@ -45,9 +45,10 @@
]
}
@defproc[(ini->file [ini mc-pair?] [file path-string?]) void?]{
@defproc[(ini->file [ini mc-pair?] [file path-string?] [#:private? private? boolean? #f]) void?]{
Writes an INI structure (as produced by @racket[file->ini] or @racket[make-ini]) to the specified file.
If file is a symbol?, the file will be constructed from the prefs-dir, the symbol and a suffix ".ini".
If @racket[private?] is @racket[#t], Unix-like systems restrict the file to mode @tt{0600} before the INI contents are written.
The output preserves:
@itemlist[
@@ -89,6 +90,7 @@ An OO wrapper around the ini functions.
@defconstructor[([file (or/c symbol? string? path? boolean?) #f]
[fail (or/c boolean?) #f]
[private? (or/c boolean?) #f]
)]{
Creates the ini from the given file.
* If (eq? file #f), an empty ini will be made.
@@ -115,6 +117,15 @@ An OO wrapper around the ini functions.
Sets the value of the 'fail' flag. See constructor for more information.
}
@defmethod*[([(get-private?) boolean?])]{
Returns whether private file permissions are enabled.
}
@defmethod*[([(set-private! [private? boolean?]) this])]{
Enables or disables private file permissions for subsequent writes.
}
@defmethod*[([(get-contents) list?])]{
Gets the contents of the ini structure as stored in memory.
}