github.com/hy3/cuto@v0.9.8-0.20160830082821-aa6652f877b7/util/path_unix.go (about)

     1  // Copyright 2015 unirita Inc.
     2  // Created 2015/04/10 shanxia
     3  
     4  // +build darwin linux
     5  
     6  package util
     7  
     8  import (
     9  	"os"
    10  	"path/filepath"
    11  )
    12  
    13  var rootPath = getCutoRoot()
    14  
    15  func getCutoRoot() string {
    16  	d := os.Getenv("CUTOROOT")
    17  	if len(d) == 0 {
    18  		panic("Not setting environment argument $CUTOROOT")
    19  	}
    20  	return d
    21  }
    22  
    23  // Rootフォルダを取得する
    24  func GetRootPath() string {
    25  	return rootPath
    26  }
    27  
    28  // 現在のフォルダパスを返す。
    29  func GetCurrentPath() string {
    30  	return filepath.Join(rootPath, "bin")
    31  }