Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Fix file sync on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Shepherd <darren@acorn.io>
  • Loading branch information
ibuildthecloud committed Oct 25, 2022
1 parent 8f1d6a7 commit 32938c4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/dev/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"os"
"path"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -57,15 +58,17 @@ func containerSync(ctx context.Context, app *apiv1.App, opts *Options) error {
}

func invokeStartSyncForPath(ctx context.Context, client client.Client, con *apiv1.ContainerReplica, cwd, localDir, remoteDir string, bidirectional bool) (chan struct{}, error) {
if s, err := os.Stat(localDir); err == nil && !s.IsDir() {
source := filepath.Join(cwd, localDir)
if s, err := os.Stat(source); err == nil && !s.IsDir() {
return nil, nil
}
err := os.MkdirAll(localDir, 0755)
err := os.MkdirAll(source, 0755)
if err != nil {
return nil, err
}
s, err := sync.NewSync(filepath.Join(cwd, localDir), sync.Options{
s, err := sync.NewSync(source, sync.Options{
DownstreamDisabled: !bidirectional,
Polling: true,
Verbose: true,
InitialSync: latest.InitialSyncStrategyPreferLocal,
Log: logpkg.NewDefaultPrefixLogger(strings.TrimPrefix(con.Name, con.Spec.AppName+".")+": (sync): ", logpkg.GetInstance()),
Expand All @@ -74,7 +77,7 @@ func invokeStartSyncForPath(ctx context.Context, client client.Client, con *apiv
return nil, err
}

cmd := filepath.Join(appdefinition.AcornHelperPath, strings.TrimSpace(appdefinition.AcornHelper))
cmd := path.Join(appdefinition.AcornHelperPath, strings.TrimSpace(appdefinition.AcornHelper))
io, err := client.ContainerReplicaExec(ctx, con.Name, []string{
cmd, "sync", "upstream", remoteDir,
}, false, nil)
Expand Down

0 comments on commit 32938c4

Please sign in to comment.