1-- | Requires fs:allow-read-text-file, fs:allow-write-text-file and/or
2-- | fs:allow-watch, plus narrowly scoped allowed paths. Watch disposal also
3-- | requires core:resources:allow-close. Dialog-picked paths
4-- | can be added to the native scope by the dialog plugin; this does not grant
5-- | parent-directory access. Register tauri-plugin-fs with its `watch` Cargo
6-- | feature for watches. No broad filesystem capability is needed or granted.
7module Tauri.FS (readText, writeText, watch) where
12import Effect.Aff (Aff)
13import Promise (Promise)
14import Promise.Aff (toAffE)
15import Tauri.Internal.Resource (acquireDisposer)
17readText :: String -> Aff String
18readText = toAffE <<< readTextImpl
20writeText :: String -> String -> Aff Unit
21writeText path contents = toAffE $ writeTextImpl path contents
23-- | Watch a file non-recursively using the official debounced watcher (2 s).
24-- | The returned, idempotent Effect calls the real native unwatch function.
25-- | Cancelling registration also releases the eventual native watch handle.
27-- | A file watch is not a durable path subscription: atomic replacement,
28-- | rename or deletion may detach the underlying OS watcher. Applications
29-- | requiring continued observation must explicitly re-register after such
30-- | changes or arrange a separately scoped parent-directory watch. This API
31-- | never widens a selected file's scope to its parent automatically.
32-- | Notifications may include this application's own writes.
34-- | Upstream UnwatchFn starts async resource closure but returns void. The
35-- | Effect therefore cannot await native cleanup; upstream rejections remain
36-- | visible as unhandled promise rejections rather than being swallowed.
37watch :: String -> Effect Unit -> Aff (Effect Unit)
38watch path changed = acquireDisposer $ watchImpl path changed
40foreign import readTextImpl :: String -> Effect (Promise String)
41foreign import writeTextImpl :: String -> String -> Effect (Promise Unit)
42foreign import watchImpl :: String -> Effect Unit -> Effect (Promise (Effect Unit))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list