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

Optimized for Windows OS #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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