diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-09 08:38:33 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-09 08:38:33 +0300 |
| commit | 7c08fe44282c076e2470fe19a1eacff209cfa4f2 (patch) | |
| tree | 65410fe3a626740a33861d93995335bb735fdece /android_shared_android.go | |
| parent | a4d5a70aa998b315e69d7a945a57ade083505011 (diff) | |
Fix shared text cache cleanup
Diffstat (limited to 'android_shared_android.go')
| -rw-r--r-- | android_shared_android.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/android_shared_android.go b/android_shared_android.go index e46fab2..b29f830 100644 --- a/android_shared_android.go +++ b/android_shared_android.go @@ -7,20 +7,20 @@ import ( "path/filepath" ) -// readSharedFromCache tries to read the shared text written by the Android activity. -// The activity writes into getCacheDir()/quicklogger-shared.txt; on Go, os.TempDir() -// maps to the same location in Android (app cache directory). -func readSharedFromCache() (string, error) { +// sharedTextCachePath returns the cache file used for Android share intents. +func sharedTextCachePath() string { dir, derr := os.UserCacheDir() if derr != nil || dir == "" { dir = os.TempDir() } - path := filepath.Join(dir, "quicklogger-shared.txt") - b, err := os.ReadFile(path) + return filepath.Join(dir, "quicklogger-shared.txt") +} + +// readSharedFromCache tries to read the shared text written by the Android activity. +func readSharedFromCache() (string, error) { + b, err := os.ReadFile(sharedTextCachePath()) if err != nil { return "", err } - // best-effort cleanup; ignore errors - _ = os.Remove(path) return string(b), nil } |
