From 00ec02907d8b77acbb39f683a335e9c23f868895 Mon Sep 17 00:00:00 2001 From: Patrick G Date: Thu, 14 Dec 2017 16:31:36 -0500 Subject: [PATCH] Normalize path seperator on Windows (fixes #1) --- kepub/epub.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kepub/epub.go b/kepub/epub.go index a745919..10d250e 100644 --- a/kepub/epub.go +++ b/kepub/epub.go @@ -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 } @@ -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 }