fix path on different OS
This commit is contained in:
@@ -2,7 +2,6 @@ package gotext
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -99,14 +98,14 @@ msgstr "Another text on another domain"
|
||||
`
|
||||
|
||||
// Create Locales directory on default location
|
||||
dirname := path.Join("/tmp", "en_US")
|
||||
dirname := filepath.Join("/tmp", "en_US")
|
||||
err := os.MkdirAll(dirname, os.ModePerm)
|
||||
if err != nil {
|
||||
t.Fatalf("Can't create test directory: %s", err.Error())
|
||||
}
|
||||
|
||||
// Write PO content to default domain file
|
||||
filename := path.Join(dirname, "default.po")
|
||||
filename := filepath.Join(dirname, "default.po")
|
||||
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
@@ -118,7 +117,7 @@ msgstr "Another text on another domain"
|
||||
t.Fatalf("Can't write to test file: %s", err.Error())
|
||||
}
|
||||
|
||||
anotherFilename := path.Join(dirname, "another.po")
|
||||
anotherFilename := filepath.Join(dirname, "another.po")
|
||||
|
||||
af, err := os.Create(anotherFilename)
|
||||
if err != nil {
|
||||
@@ -198,14 +197,14 @@ msgstr[1] ""
|
||||
`
|
||||
|
||||
// Create Locales directory on default location
|
||||
dirname := path.Join("/tmp", "en_US")
|
||||
dirname := filepath.Join("/tmp", "en_US")
|
||||
err := os.MkdirAll(dirname, os.ModePerm)
|
||||
if err != nil {
|
||||
t.Fatalf("Can't create test directory: %s", err.Error())
|
||||
}
|
||||
|
||||
// Write PO content to default domain file
|
||||
filename := path.Join(dirname, "default.po")
|
||||
filename := filepath.Join(dirname, "default.po")
|
||||
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
@@ -318,19 +317,19 @@ msgstr[1] "Custom ctx translations"
|
||||
`
|
||||
|
||||
// Create Locales directory and files on temp location
|
||||
dirname := path.Join("/tmp", "en_US")
|
||||
dirname := filepath.Join("/tmp", "en_US")
|
||||
err := os.MkdirAll(dirname, os.ModePerm)
|
||||
if err != nil {
|
||||
t.Fatalf("Can't create test directory: %s", err.Error())
|
||||
}
|
||||
|
||||
fDefault, err := os.Create(path.Join(dirname, "default.po"))
|
||||
fDefault, err := os.Create(filepath.Join(dirname, "default.po"))
|
||||
if err != nil {
|
||||
t.Fatalf("Can't create test file: %s", err.Error())
|
||||
}
|
||||
defer fDefault.Close()
|
||||
|
||||
fCustom, err := os.Create(path.Join(dirname, "custom.po"))
|
||||
fCustom, err := os.Create(filepath.Join(dirname, "custom.po"))
|
||||
if err != nil {
|
||||
t.Fatalf("Can't create test file: %s", err.Error())
|
||||
}
|
||||
@@ -408,14 +407,14 @@ msgstr "Some random Translation in a context"
|
||||
`
|
||||
|
||||
// Create Locales directory on default location
|
||||
dirname := path.Join("/tmp", "en_US")
|
||||
dirname := filepath.Join("/tmp", "en_US")
|
||||
err := os.MkdirAll(dirname, os.ModePerm)
|
||||
if err != nil {
|
||||
t.Fatalf("Can't create test directory: %s", err.Error())
|
||||
}
|
||||
|
||||
// Write PO content to default domain file
|
||||
filename := path.Join("/tmp", GetDomain()+".po")
|
||||
filename := filepath.Join("/tmp", GetDomain()+".po")
|
||||
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
@@ -437,7 +436,7 @@ msgstr "Some random Translation in a context"
|
||||
defer wg.Done()
|
||||
|
||||
GetLibrary()
|
||||
SetLibrary(path.Join("/tmp", "gotextlib"))
|
||||
SetLibrary(filepath.Join("/tmp", "gotextlib"))
|
||||
GetDomain()
|
||||
SetDomain("default")
|
||||
GetLanguage()
|
||||
|
||||
Reference in New Issue
Block a user