Skip to content

Commit

Permalink
switch back from git to getcwd
Browse files Browse the repository at this point in the history
  • Loading branch information
3vilhamster committed Dec 18, 2023
1 parent 5465f1d commit f1413f9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions common/persistence/nosql/nosqlplugin/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@
package nosqlplugin

import (
"fmt"
"os/exec"
"os"
"strings"
)

func getCadencePackageDir() (string, error) {
cmdOut, err := exec.Command("git", "rev-parse", "--show-toplevel").CombinedOutput()
cadencePackageDir, err := os.Getwd()
if err != nil {
return "", fmt.Errorf("get root directory failed: error %w, output %s", err, cmdOut)
panic(err)
}

return strings.TrimSpace(string(cmdOut)), err
cadenceIndex := strings.LastIndex(cadencePackageDir, "cadence/")
cadencePackageDir = cadencePackageDir[:cadenceIndex+len("cadence/")]
return cadencePackageDir, err
}

func GetDefaultTestSchemaDir(testSchemaRelativePath string) (string, error) {
cadencePackageDir, err := getCadencePackageDir()
if err != nil {
return "", err
}
return fmt.Sprintf("%s/%s", cadencePackageDir, testSchemaRelativePath), nil
return cadencePackageDir + testSchemaRelativePath, nil
}

0 comments on commit f1413f9

Please sign in to comment.