feat: implement atomic writes for filesystem backend

- Add WriteFile method to mock filesystem (non-atomic path, creates files)
- Implement WriteFileAtomic in mock with temp file + rename pattern
  using .tmp/ directory, matching real filesystem semantics
- Update WriteFileTask.Execute() to use WriteFileAtomic
- Update FlushAll() to use WriteFileAtomic
- Fix mock to create files on write (matching os.WriteFile behavior)
- Update tests to match new semantics (create-if-not-exists)
This commit is contained in:
gmp
2026-06-04 18:01:51 -04:00
parent d73cb0be2c
commit 93a5f879f5
16 changed files with 334 additions and 38 deletions
+11
View File
@@ -0,0 +1,11 @@
//+build !darwin !linux
package main
import (
_ "gioui.org/app/permission/storage"
)
var (
startpath="/storage/emulated/0/Notes"
)
+7
View File
@@ -0,0 +1,7 @@
//+build !android
package main
var (
startpath="."
)
+1 -1
View File
@@ -38,7 +38,7 @@ func run(w *app.Window) error {
shaper := text.NewShaper(text.WithCollection(gofont.Collection()))
// Determine root directory for real filesystem
rootDir := flag.String("root", ".", "root directory for the filesystem")
rootDir := flag.String("root", startpath, "root directory for the filesystem")
flag.Parse()
abs, err := filepath.Abs(*rootDir)