From 1718bf6f7ea6c529976b1d24b0b7cc8389ca201e Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Mon, 22 Jan 2024 13:08:39 +0600 Subject: [PATCH] :bug: Fixed double slashes in Path.Dir --- internal/domain/path.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/domain/path.go b/internal/domain/path.go index 0161eb9..651bacd 100644 --- a/internal/domain/path.go +++ b/internal/domain/path.go @@ -24,7 +24,7 @@ func NewPath(path string) Path { Language: LanguageUnd, baseFileName: "", contentBaseName: "", - dir: filepath.Dir(path) + "/", + dir: filepath.Dir(path), ext: strings.TrimPrefix(filepath.Ext(path), "."), filename: path, logicalName: filepath.Base(path), @@ -34,6 +34,10 @@ func NewPath(path string) Path { } out.baseFileName = strings.TrimSuffix(out.logicalName, filepath.Ext(out.logicalName)) + if out.dir[len(out.dir)-1] != '/' { + out.dir += string(filepath.Separator) + } + parts := strings.Split(out.baseFileName, ".") out.Language = NewLanguage(parts[len(parts)-1]) out.translationBaseName = strings.Join(parts[:len(parts)-1], ".")