-
Notifications
You must be signed in to change notification settings - Fork 39
/
path.go
35 lines (29 loc) · 1.18 KB
/
path.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
package golang
import (
"github.com/brutella/hap/gen"
"os"
"path/filepath"
)
var (
libPath = os.ExpandEnv("$GOPATH/src/github.com/brutella/hap")
ServiceLocalDir = filepath.Join(libPath, "service")
CharacteristicLocalDir = filepath.Join(libPath, "characteristic")
ServiceDir = "service"
CharacteristicDir = "characteristic"
)
// CharacteristicLocalFilePath returns the filepath to a characteristic
func CharacteristicLocalFilePath(char *gen.CharacteristicMetadata) string {
return filepath.Join(CharacteristicLocalDir, CharacteristicFileName(char))
}
// CharacteristicRelativeFilePath returns the relative filepath to a characteristic
func CharacteristicRelativeFilePath(char *gen.CharacteristicMetadata) string {
return filepath.Join(CharacteristicDir, CharacteristicFileName(char))
}
// ServiceLocalFilePath returns the filepath to a service
func ServiceLocalFilePath(sv *gen.ServiceMetadata) string {
return filepath.Join(ServiceLocalDir, ServiceFileName(sv))
}
// ServiceRelativeFilePath returns the relative filepath to a service
func ServiceRelativeFilePath(sv *gen.ServiceMetadata) string {
return filepath.Join(ServiceDir, ServiceFileName(sv))
}