Skip to content

Commit

Permalink
cmd/localbin.go: fix pathing for windows
Browse files Browse the repository at this point in the history
If a windows path is provided as the local path to mount the binary or front end source directory, it will have invalid backslashes not recognized by docker, unless you escape them manually. This fix allows for using the default windows path with no escaping required, however the path must be provided in quotes.

Change-Id: I0ddde0c5a6d44976cf074455c4aa56c21ed35b69
  • Loading branch information
dlamarmorgan committed Sep 29, 2022
1 parent ad9e370 commit 3fd7726
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/localbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package cmd
import (
"os"
"path"
"path/filepath"
"strings"

"github.com/compose-spec/compose-go/types"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -60,7 +62,7 @@ func localWebSatelliteCmd() *cobra.Command {
return err
}

updatedComposeProject, err := common.UpdateEach(composeProject, mountWebSatellite, webSatPath[0], []string{"satellite-api"})
updatedComposeProject, err := common.UpdateEach(composeProject, mountWebSatellite, strings.ReplaceAll(webSatPath[0], string(filepath.Separator), "/"), []string{"satellite-api"})
if err != nil {
return err
}
Expand All @@ -81,7 +83,7 @@ func mountBinaries(composeService *types.ServiceConfig, _ string) error {
if command != "" {
execName = command
}
source := path.Join(path.Join(dir, subdir), execName)
source := strings.ReplaceAll(path.Join(path.Join(dir, subdir), execName), string(filepath.Separator), "/")
target := path.Join("/var/lib/storj/go/bin", execName)
for i, volume := range composeService.Volumes {
if volume.Type == "bind" &&
Expand Down

0 comments on commit 3fd7726

Please sign in to comment.