prototype of platform specific code

pull/40/head
V2Ray 2015-10-09 16:48:05 +02:00
parent cdea39ff95
commit ab84639aaa
3 changed files with 43 additions and 0 deletions

16
common/platform/others.go Normal file
View File

@ -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)
}

View File

@ -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)
}

View File

@ -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
}