Browse Source

prototype of platform specific code

pull/40/head
V2Ray 9 years ago
parent
commit
ab84639aaa
  1. 16
      common/platform/others.go
  2. 10
      common/platform/platform.go
  3. 17
      common/platform/windows.go

16
common/platform/others.go

@ -0,0 +1,16 @@
// +build !windows
package platform
import (
"os"
)
type otherPlatformEnvironment struct {
}
var environmentInstance = &otherPlatformEnvironment{}
func (e *otherPlatformEnvironment) ExpandEnv(s string) string {
return os.ExpandEnv(s)
}

10
common/platform/platform.go

@ -0,0 +1,10 @@
// Package platform provides platform specific functionalities.
package platform
type environment interface {
ExpandEnv(s string) string
}
func ExpandEnv(s string) string {
return environmentInstance.ExpandEnv(s)
}

17
common/platform/windows.go

@ -0,0 +1,17 @@
// +build windows
package platform
import (
"os"
)
type windowsEnvironment struct {
}
var environmentInstance = &windowsEnvironment{}
func (e *windowsEnvironment) ExpandEnv(s string) string {
// TODO
return s
}
Loading…
Cancel
Save