Skip to content

Commit

Permalink
Normalize path seperator on Windows (fixes #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Dec 14, 2017
1 parent aa85e8b commit 00ec029
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kepub/epub.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ func PackEPUB(src, dest string, overwritedest bool) error {
return fmt.Errorf(`error getting relative path of "%s"`, path)
}

if path == dest {
// Fix issue with path separators in zip on windows
relativePath = filepath.ToSlash(relativePath)

if filepath.ToSlash(path) == filepath.ToSlash(dest) {
// Skip if it is trying to pack itself
return nil
}
Expand All @@ -175,7 +178,7 @@ func PackEPUB(src, dest string, overwritedest bool) error {
return nil
}

if path == filepath.Join(src, "mimetype") {
if filepath.ToSlash(path) == filepath.ToSlash(filepath.Join(src, "mimetype")) {
// Skip if it is the mimetype file
return nil
}
Expand Down

0 comments on commit 00ec029

Please sign in to comment.