🐛 Fixed double slashes in Path.Dir
This commit is contained in:
parent
733a3e4e8b
commit
1718bf6f7e
|
@ -24,7 +24,7 @@ func NewPath(path string) Path {
|
||||||
Language: LanguageUnd,
|
Language: LanguageUnd,
|
||||||
baseFileName: "",
|
baseFileName: "",
|
||||||
contentBaseName: "",
|
contentBaseName: "",
|
||||||
dir: filepath.Dir(path) + "/",
|
dir: filepath.Dir(path),
|
||||||
ext: strings.TrimPrefix(filepath.Ext(path), "."),
|
ext: strings.TrimPrefix(filepath.Ext(path), "."),
|
||||||
filename: path,
|
filename: path,
|
||||||
logicalName: filepath.Base(path),
|
logicalName: filepath.Base(path),
|
||||||
|
@ -34,6 +34,10 @@ func NewPath(path string) Path {
|
||||||
}
|
}
|
||||||
out.baseFileName = strings.TrimSuffix(out.logicalName, filepath.Ext(out.logicalName))
|
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, ".")
|
parts := strings.Split(out.baseFileName, ".")
|
||||||
out.Language = NewLanguage(parts[len(parts)-1])
|
out.Language = NewLanguage(parts[len(parts)-1])
|
||||||
out.translationBaseName = strings.Join(parts[:len(parts)-1], ".")
|
out.translationBaseName = strings.Join(parts[:len(parts)-1], ".")
|
||||||
|
|
Loading…
Reference in New Issue