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:
@@ -0,0 +1,11 @@
|
||||
//+build !darwin !linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "gioui.org/app/permission/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
startpath="/storage/emulated/0/Notes"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
//+build !android
|
||||
|
||||
package main
|
||||
|
||||
var (
|
||||
startpath="."
|
||||
)
|
||||
+1
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user