Skip to content

Commit

Permalink
Ensure filepaths are using forward slash
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan committed Nov 7, 2024
1 parent 445dbe4 commit 67c2110
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/archiver/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package archiver

import (
"os"
"path/filepath"
"strings"

"github.com/ActiveState/cli/internal/errs"
Expand Down Expand Up @@ -57,10 +58,11 @@ func CreateTgz(filepath string, fileMaps []FileMap) error {
func FilesWithCommonParent(filepaths ...string) []FileMap {
var fileMaps []FileMap
common := fileutils.CommonParentPath(filepaths)
for _, filepath := range filepaths {
for _, path := range filepaths {
path = filepath.ToSlash(path)
fileMaps = append(fileMaps, FileMap{
Source: filepath,
Target: strings.TrimPrefix(strings.TrimPrefix(filepath, common), "/"),
Source: filepath.ToSlash(path),
Target: strings.TrimPrefix(filepath.ToSlash(strings.TrimPrefix(path, common)), "/"),
})
}
return fileMaps
Expand Down

0 comments on commit 67c2110

Please sign in to comment.