This repository has been archived by the owner on Jan 14, 2024. It is now read-only.
forked from fyne-io/fyne
/
package-util.go
80 lines (60 loc) · 1.75 KB
/
package-util.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package commands
import (
"os"
realUtil "github.com/Anwert/fyne/v2/cmd/fyne/internal/util"
)
type packagerUtil interface {
Exists(path string) bool
CopyFile(source string, target string) error
CopyExeFile(src, tgt string) error
WriteFile(target string, data []byte) error
EnsureSubDir(parent, name string) string
EnsureAbsPath(path string) string
MakePathRelativeTo(root, path string) string
RequireAndroidSDK() error
AndroidBuildToolsPath() string
IsAndroid(os string) bool
IsIOS(os string) bool
IsMobile(os string) bool
}
type defaultUtil struct{}
func (d defaultUtil) Exists(path string) bool {
return realUtil.Exists(path)
}
func (d defaultUtil) CopyFile(source string, target string) error {
return realUtil.CopyFile(source, target)
}
func (d defaultUtil) CopyExeFile(src, tgt string) error {
return realUtil.CopyExeFile(src, tgt)
}
func (d defaultUtil) WriteFile(target string, data []byte) error {
return os.WriteFile(target, data, 0644)
}
func (d defaultUtil) EnsureSubDir(parent, name string) string {
return realUtil.EnsureSubDir(parent, name)
}
func (d defaultUtil) EnsureAbsPath(path string) string {
return realUtil.EnsureAbsPath(path)
}
func (d defaultUtil) MakePathRelativeTo(root, path string) string {
return realUtil.MakePathRelativeTo(root, path)
}
func (d defaultUtil) RequireAndroidSDK() error {
return realUtil.RequireAndroidSDK()
}
func (d defaultUtil) AndroidBuildToolsPath() string {
return realUtil.AndroidBuildToolsPath()
}
func (d defaultUtil) IsAndroid(os string) bool {
return realUtil.IsAndroid(os)
}
func (d defaultUtil) IsIOS(os string) bool {
return realUtil.IsIOS(os)
}
func (d defaultUtil) IsMobile(os string) bool {
return realUtil.IsMobile(os)
}
var util packagerUtil
func init() {
util = defaultUtil{}
}