Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2014-12-07 21:48:00 +0300
committerspf13 <steve.francia@gmail.com>2014-12-09 17:43:15 +0300
commit9f77f93071d836a35b0078d1b349968abddb4a18 (patch)
tree909238a41b20b9e23324e4ffca01e8143655dd4a /source
parent3a8c12418a97230df714488e522f44ce8af685c5 (diff)
Fix various Windows-issues
File handling was broken on Windows. This commit contains a revision of the path handling with separation of file paths and urls where needed. There may be remaining issues and there may be better ways to do this, but it is easier to start that refactoring job with a set of passing tests. Fixes #687 Fixes #660
Diffstat (limited to 'source')
-rw-r--r--source/file.go8
-rw-r--r--source/filesystem_windows_test.go8
2 files changed, 7 insertions, 9 deletions
diff --git a/source/file.go b/source/file.go
index 4c6196a9f..a4a5b27c3 100644
--- a/source/file.go
+++ b/source/file.go
@@ -14,12 +14,10 @@
package source
import (
+ "github.com/spf13/hugo/helpers"
"io"
- "path"
"path/filepath"
"strings"
-
- "github.com/spf13/hugo/helpers"
)
type File struct {
@@ -65,7 +63,7 @@ func (f *File) LogicalName() string {
if f.logicalName != "" {
return f.logicalName
} else {
- _, f.logicalName = path.Split(f.relpath)
+ _, f.logicalName = filepath.Split(f.relpath)
return f.logicalName
}
}
@@ -78,7 +76,7 @@ func (f *File) Dir() string {
if f.dir != "" {
return f.dir
} else {
- f.dir, _ = path.Split(f.relpath)
+ f.dir, _ = filepath.Split(f.relpath)
return f.dir
}
}
diff --git a/source/filesystem_windows_test.go b/source/filesystem_windows_test.go
index e9cbdd4a1..ee6185374 100644
--- a/source/filesystem_windows_test.go
+++ b/source/filesystem_windows_test.go
@@ -8,8 +8,8 @@ package source
var platformBase = "C:\\foo\\"
var platformPaths = []TestPath{
{"foobar", "foobar", "aaa", "", ""},
- {"b\\1file", "1file", "aaa", "b", "b/"},
- {"c\\d\\2file", "2file", "aaa", "c", "c/d/"},
- {"C:\\foo\\e\\f\\3file", "3file", "aaa", "e", "e/f/"}, // note volume case is equal to platformBase
- {"section\\foo.rss", "foo.rss", "aaa", "section", "section/"},
+ {"b\\1file", "1file", "aaa", "b", "b\\"},
+ {"c\\d\\2file", "2file", "aaa", "c", "c\\d\\"},
+ {"C:\\foo\\e\\f\\3file", "3file", "aaa", "e", "e\\f\\"}, // note volume case is equal to platformBase
+ {"section\\foo.rss", "foo.rss", "aaa", "section", "section\\"},
}