From e85baa72f6c4b3407013d7c0a9caa996f38ec555 Mon Sep 17 00:00:00 2001 From: amorozov Date: Fri, 21 Jun 2024 18:44:26 +0300 Subject: [PATCH] feature: refactoring --- pkg/io/files/file_exists_checker.go | 11 ----------- ...parent_file_creator.go => parent_dir_creator.go} | 0 pkg/io/files/parent_dir_utils.go | 13 +++++++++++++ 3 files changed, 13 insertions(+), 11 deletions(-) rename pkg/io/files/{parent_file_creator.go => parent_dir_creator.go} (100%) create mode 100644 pkg/io/files/parent_dir_utils.go diff --git a/pkg/io/files/file_exists_checker.go b/pkg/io/files/file_exists_checker.go index be92e3d..1629370 100644 --- a/pkg/io/files/file_exists_checker.go +++ b/pkg/io/files/file_exists_checker.go @@ -3,7 +3,6 @@ package files import ( "errors" "os" - "strings" ) func IsFileExists(fileLocation string) bool { @@ -13,13 +12,3 @@ func IsFileExists(fileLocation string) bool { return true } - -func GetParentDir(fileLocation string) string { - fileLocation = strings.ReplaceAll(fileLocation, "\\", "/") - indexOfSlash := strings.LastIndex(fileLocation, "/") - if indexOfSlash > 0 { - return fileLocation[:indexOfSlash] - } - - return "" -} diff --git a/pkg/io/files/parent_file_creator.go b/pkg/io/files/parent_dir_creator.go similarity index 100% rename from pkg/io/files/parent_file_creator.go rename to pkg/io/files/parent_dir_creator.go diff --git a/pkg/io/files/parent_dir_utils.go b/pkg/io/files/parent_dir_utils.go new file mode 100644 index 0000000..d31eeea --- /dev/null +++ b/pkg/io/files/parent_dir_utils.go @@ -0,0 +1,13 @@ +package files + +import "strings" + +func GetParentDir(fileLocation string) string { + fileLocation = strings.ReplaceAll(fileLocation, "\\", "/") + indexOfSlash := strings.LastIndex(fileLocation, "/") + if indexOfSlash > 0 { + return fileLocation[:indexOfSlash] + } + + return "" +}