feature: added dir creator
parent
cf8adf9059
commit
67d71f2eef
|
@ -0,0 +1,12 @@
|
||||||
|
package files
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.tswf.io/incredible-go/incredible-go-core/pkg/io/files/file_perm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MkdirsAutoPerm(dirLocation string) error {
|
||||||
|
perm := file_perm.GetPermForDir(dirLocation)
|
||||||
|
return os.MkdirAll(dirLocation, perm)
|
||||||
|
}
|
|
@ -1,15 +1,9 @@
|
||||||
package files
|
package files
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"git.tswf.io/incredible-go/incredible-go-core/pkg/io/files/file_perm"
|
|
||||||
)
|
|
||||||
|
|
||||||
func MkdirParent(fileLocation string) error {
|
func MkdirParent(fileLocation string) error {
|
||||||
parentDir := GetParentDir(fileLocation)
|
parentDir := GetParentDir(fileLocation)
|
||||||
if parentDir != "" {
|
if parentDir != "" {
|
||||||
parentDirCreationErr := os.MkdirAll(parentDir, file_perm.GetPermForDir(parentDir))
|
parentDirCreationErr := MkdirsAutoPerm(parentDir)
|
||||||
|
|
||||||
if parentDirCreationErr != nil {
|
if parentDirCreationErr != nil {
|
||||||
return parentDirCreationErr
|
return parentDirCreationErr
|
||||||
|
|
Loading…
Reference in New Issue