Last active
December 22, 2018 03:12
-
-
Save syossan27/1869a9ce465b70465b1bd707efcb5dd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package foundation | |
| import ( | |
| "os" | |
| "github.com/mitchellh/go-homedir" | |
| ) | |
| var ( | |
| homeDir, _ = homedir.Dir() | |
| ConfigDirPath = homeDir + "/.en" | |
| KeyPath = homeDir + "/.ssh/id_rsa" | |
| // 接続情報管理ファイル | |
| StorePath = homeDir + "/.en/store" | |
| ) | |
| func MakeConfig() { | |
| // 接続情報管理ファイルを置くディレクトリの確認、及び生成 | |
| if _, err := os.Stat(ConfigDirPath); err != nil { | |
| err := os.Mkdir(ConfigDirPath, 0777) | |
| if err != nil { | |
| PrintError("Failed to create .en directory") | |
| } | |
| } | |
| // 接続情報管理ファイルの確認、及び生成 | |
| if _, err := os.Stat(StorePath); err != nil { | |
| _, err := os.Create(StorePath) | |
| if err != nil { | |
| PrintError("Failed to create store file") | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment