summaryrefslogtreecommitdiff
path: root/android_shared_android.go
diff options
context:
space:
mode:
Diffstat (limited to 'android_shared_android.go')
-rw-r--r--android_shared_android.go16
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
}