blob: b736fab171a0c68576253777628980c5fb053bb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
//go:build android
package main
import (
"os"
"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) {
dir, derr := os.UserCacheDir()
if derr != nil || dir == "" {
dir = os.TempDir()
}
path := filepath.Join(dir, "quicklogger-shared.txt")
b, err := os.ReadFile(path)
if err != nil {
return "", err
}
// best-effort cleanup; ignore errors
_ = os.Remove(path)
return string(b), nil
}
func debugSharedPath() string {
dir, _ := os.UserCacheDir()
if dir == "" {
dir = os.TempDir()
}
return filepath.Join(dir, "quicklogger-shared.txt")
}
|