diff --git a/internal/docker/project.go b/internal/docker/project.go index b6f2b2a..280ee7d 100644 --- a/internal/docker/project.go +++ b/internal/docker/project.go @@ -43,13 +43,13 @@ func (project *Project) Start() error { os.MkdirAll(getAbsoluteProjectPath(*project), os.ModePerm) if project.Local != "" { var srcDir string - if strings.HasPrefix(project.Local, "/") { - srcDir = project.Local - } else { - root, _ := os.Getwd() - srcDir = root + "/" + project.Local + if !strings.HasPrefix(project.Local, "/") { + srcDir = "./" + project.Local + } + err := copyutil.CopyDir(filesys.MakeFsOnDisk(), srcDir, getRelativeProjectPath(*project)) + if err != nil { + return errors.Join(errors.New("cannot copy directory "+srcDir+" to "+getRelativeProjectPath(*project)), err) } - copyutil.CopyDir(filesys.MakeFsOnDisk(), srcDir, getAbsoluteProjectPath(*project)) } else { gitArgs := []string{"clone", project.Repository, getAbsoluteProjectPath(*project)} if project.Branch != "" { @@ -160,3 +160,7 @@ func getAbsoluteProjectPath(project Project) string { root, _ := os.Getwd() return root + "/workspace/" + project.Name } + +func getRelativeProjectPath(project Project) string { + return "./workspace/" + project.Name +}