mirror of
https://github.com/cheat/cheat.git
synced 2025-09-05 19:42:55 +02:00
fix: Windows support
Fix an issue whereby the installer installed cheatsheets into the wrong directory on Windows. This occurred because previously `path.Join` was used where `path/filepath.Join` should have been used. This matters, because the former always uses `/` as the path separator, whereas the latter will use `/` or `\` as is appropriate for the runtime environment. This should resolve bullet point 4 in #665.
This commit is contained in:
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// Copy copies a cheatsheet to a new location
|
||||
@ -22,7 +22,7 @@ func (s *Sheet) Copy(dest string) error {
|
||||
defer infile.Close()
|
||||
|
||||
// create any necessary subdirectories
|
||||
dirs := path.Dir(dest)
|
||||
dirs := filepath.Dir(dest)
|
||||
if dirs != "." {
|
||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create directory: %s, %v", dirs, err)
|
||||
|
Reference in New Issue
Block a user