mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-21 09:42:11 +00:00
1e7b32490d
This allows for building GoToSocial with [SQLite transpiled to WASM](https://github.com/ncruces/go-sqlite3) and accessed through [Wazero](https://wazero.io/).
21 lines
407 B
Go
21 lines
407 B
Go
package sysfs
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/tetratelabs/wazero/experimental/sys"
|
|
)
|
|
|
|
func fsync(f *os.File) sys.Errno {
|
|
errno := sys.UnwrapOSError(f.Sync())
|
|
// Coerce error performing stat on a directory to 0, as it won't work
|
|
// on Windows.
|
|
switch errno {
|
|
case sys.EACCES /* Go 1.20 */, sys.EBADF /* Go 1.19 */ :
|
|
if st, err := f.Stat(); err == nil && st.IsDir() {
|
|
errno = 0
|
|
}
|
|
}
|
|
return errno
|
|
}
|