-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed namespace folder creation, and added fileutils
- Loading branch information
1 parent
371aa41
commit 6398d81
Showing
4 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package fileutils | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
func EnsurePathExists(elements ...string) error { | ||
fullPath := filepath.Join(elements...) | ||
|
||
err := os.MkdirAll(fullPath, os.ModeDir) | ||
if err != nil { | ||
log.Err(err).Msg("Cannot create folder structure") | ||
} | ||
return err | ||
} | ||
|
||
func CreateFileAt() { | ||
|
||
} | ||
|
||
func MoveFile(oldPath string, newPath string) error { | ||
err := os.Rename(oldPath, newPath) | ||
if err != nil { | ||
log.Err(err).Msg("File move failed!") | ||
} | ||
return err | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package fileutils | ||
|
||
// Test EnsurePathexists with 0, 1 and more []string |
This file contains 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