GetApplicationDirectory returns an absolute path of the application directory.
()
| 44 | |
| 45 | // GetApplicationDirectory returns an absolute path of the application directory. |
| 46 | func (gf *GlobalFlags) GetApplicationDirectory() (string, error) { |
| 47 | appDir := conv.S(gf.AppDirectory) |
| 48 | if utils.IsBlank(appDir) { |
| 49 | appDir = "." // default: current working directory |
| 50 | } |
| 51 | |
| 52 | // resolve to absolute path |
| 53 | absPath, err := filepath.Abs(appDir) |
| 54 | if err != nil { |
| 55 | return "", fmt.Errorf("Error retrieving absolute path [%s]: %s", appDir, err.Error()) |
| 56 | } |
| 57 | |
| 58 | return absPath, nil |
| 59 | } |
| 60 | |
| 61 | // GetConfigFile returns an absolute path of the configuration file. |
| 62 | func (gf *GlobalFlags) GetConfigFile() (string, error) { |
no test coverage detected