mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-28 18:38:24 -05:00
fix(build): use absolute path for zip output in release
The zip command in Release.Zip() sets its working directory to the
release subfolder but used a relative output path, causing it to
resolve against the wrong directory. This was a latent bug surfaced
by e19a61479 which removed the global RootPath variable.
Fix by resolving the zip output path to an absolute path using
os.Getwd() at the start of the function.
This commit is contained in:
@@ -903,6 +903,11 @@ func (Release) OsPackage() error {
|
||||
|
||||
// Zip creates a zip file from all os-package folders in dist/release
|
||||
func (Release) Zip() error {
|
||||
rootDir, err := os.Getwd()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not get working directory: %w", err)
|
||||
}
|
||||
|
||||
p := "./" + DIST + "/release/"
|
||||
if err := filepath.Walk(p, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
@@ -914,7 +919,8 @@ func (Release) Zip() error {
|
||||
|
||||
fmt.Printf("Zipping %s...\n", info.Name())
|
||||
|
||||
c := exec.Command("zip", "-r", "./"+DIST+"/zip/"+info.Name()+".zip", ".", "-i", "*")
|
||||
zipFile := filepath.Join(rootDir, DIST, "zip", info.Name()+".zip")
|
||||
c := exec.Command("zip", "-r", zipFile, ".", "-i", "*")
|
||||
c.Dir = path
|
||||
out, err := c.Output()
|
||||
fmt.Print(string(out))
|
||||
|
||||
Reference in New Issue
Block a user