diff --git a/gapi/helpers.go b/gapi/helpers.go index 1a8cf999..5da9c743 100644 --- a/gapi/helpers.go +++ b/gapi/helpers.go @@ -58,6 +58,8 @@ func CopyStringToFs(fs engine.Fs, str, dst string) error { } // CopyDirToFs copies a dir from src path on the local fs to a dst path on fs. +// FIXME: I'm not sure this does the logical thing when the dst path is a dir. +// FIXME: We've got a workaround for this inside of the lang CLI GAPI. func CopyDirToFs(fs engine.Fs, src, dst string) error { return util.CopyDiskToFs(fs, src, dst, false) } diff --git a/lang/gapi.go b/lang/gapi.go index e77100af..09350af9 100644 --- a/lang/gapi.go +++ b/lang/gapi.go @@ -340,6 +340,15 @@ func (obj *GAPI) Cli(cliInfo *gapi.CliInfo) (*gapi.Deploy, error) { } if strings.HasSuffix(src, "/") { // it's a dir + // FIXME: I think fixing CopyDirToFs might be better... + if dst != "/" { // XXX: hack, don't nest the copy badly! + out, err := util.RemovePathSuffix(dst) + if err != nil { + // possible programming error + return nil, errwrap.Wrapf(err, "malformed dst dir path: `%s`", dst) + } + dst = out + } // TODO: add more tests to this (it is actually CopyFs) if err := gapi.CopyDirToFs(fs, src, dst); err != nil { return nil, errwrap.Wrapf(err, "can't copy dir from `%s` to `%s`", src, dst)