OSDN Git Service

Merge pull request #41 from Bytom/dev
[bytom/vapor.git] / blockchain / env.go
1 package blockchain
2
3 import (
4         "os"
5         "path/filepath"
6 )
7
8 // HomeDirFromEnvironment returns the directory to use
9 // for reading config and storing variable data.
10 // It returns $BYTOM_HOME,
11 // or, if that is empty, $HOME/.chaincore.
12 func HomeDirFromEnvironment() string {
13         if s := os.Getenv("BYTOM_HOME"); s != "" {
14                 return s
15         }
16         return filepath.Join(os.Getenv("HOME"), ".bytom")
17 }