(logger *zap.Logger, originalPath string)
| 745 | } |
| 746 | |
| 747 | func ToAbsPath(logger *zap.Logger, originalPath string) string { |
| 748 | path := originalPath |
| 749 | //if user provides relative path |
| 750 | if len(path) > 0 && path[0] != '/' { |
| 751 | absPath, err := filepath.Abs(path) |
| 752 | if err != nil { |
| 753 | LogError(logger, err, "failed to get the absolute path from relative path") |
| 754 | } |
| 755 | path = absPath |
| 756 | } else if len(path) == 0 { // if user doesn't provide any path |
| 757 | cdirPath, err := os.Getwd() |
| 758 | if err != nil { |
| 759 | LogError(logger, err, "failed to get the path of current directory") |
| 760 | } |
| 761 | path = cdirPath |
| 762 | } |
| 763 | path += "/keploy" |
| 764 | return path |
| 765 | } |
| 766 | |
| 767 | // makeDirectory creates a directory if not exists with all user access |
| 768 | func makeDirectory(path string) error { |
no test coverage detected