Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Optimized for Windows OS
Browse files Browse the repository at this point in the history
  • Loading branch information
moyamejiasr committed Feb 16, 2018
1 parent b0e9199 commit 741728a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"path/filepath"
"time"
"strings"
)

const (
Expand Down Expand Up @@ -146,6 +147,7 @@ func newPackage() *pkg {
}

func (p *pkg) addToManifest(id string, href string, mediaType string, properties string) {
href = strings.Replace(href, "\\", "/", -1)
i := &pkgItem{
ID: id,
Href: href,
Expand Down
2 changes: 2 additions & 0 deletions toc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"path/filepath"
"strconv"
"strings"
)

const (
Expand Down Expand Up @@ -148,6 +149,7 @@ func newTocNcxXML() *tocNcxRoot {

// Add a section to the TOC (navXML as well as ncxXML)
func (t *toc) addSection(index int, title string, relativePath string) {
relativePath = strings.Replace(relativePath, "\\", "/", -1)
l := &tocNavItem{
A: tocNavLink{
Href: relativePath,
Expand Down
1 change: 1 addition & 0 deletions write.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func (e *Epub) writeEpub(tempDir string, destFilePath string) error {

// Get the path of the file relative to the folder we're zipping
relativePath, err := filepath.Rel(tempDir, path)
relativePath = strings.Replace(relativePath, "\\", "/", -1)
if err != nil {
// tempDir and path are both internal, so we shouldn't get here
panic(fmt.Sprintf("Error closing EPUB file: %s", err))
Expand Down

0 comments on commit 741728a

Please sign in to comment.