#how to pass O.APPEND to std.fs.createFileAbsolute?

1 messages · Page 1 of 1 (latest)

rotund compass
#

hi folks, is that intended? because this function has an option named truncate: bool, so i assumed there should be an append: bool or a fs.appendFileAbsolute.
but none of them exists.

#

how to pass O.APPEND to std.fs.createFileAbsolute?

spice barn
#

I'm not sure if there is a way directly, what you can do is create/open with .truncate = false, and seek to the end

rotund compass
#

yeah, i surely can do that.
but i think that approach is a waste, since it means open + stat + seek, while it can be done using a single open(...TRUNC|CREAT|APPEND)

spice barn
#

taking another look, it looks like CreateFlags has another field mode

#

I'll wager a guess that might be what you want

rotund compass
#

unfortunately, it did not work. it's a real mode, while O.APPEND is a flag
(const file = try fs.createFileAbsolute(facts.dbpath, .{.truncate = false, .mode = 0o400 | linux.O.APPEND});)

#

default to 0o600. never mind, os.open is good enough for me