This commit is contained in:
maddalax 2024-09-23 15:45:10 -05:00
parent fb8bacdf45
commit 4531d56344
2 changed files with 17 additions and 2 deletions

View file

@ -52,6 +52,21 @@ func CopyDir(srcDir, dstDir string, predicate func(path string, exists bool) boo
}) })
} }
func MoveFile(src, dst string) error {
slog.Debug("moving file", slog.String("src", src), slog.String("dst", dst))
// Copy the file.
err := CopyFile(src, dst)
if err != nil {
return fmt.Errorf("failed to copy file: %v", err)
}
// Remove the source file.
err = os.Remove(src)
if err != nil {
return fmt.Errorf("failed to remove source file: %v", err)
}
return nil
}
func CopyFile(src, dst string) error { func CopyFile(src, dst string) error {
slog.Debug("copying file", slog.String("src", src), slog.String("dst", dst)) slog.Debug("copying file", slog.String("src", src), slog.String("dst", dst))
// Open the source file for reading. // Open the source file for reading.

View file

@ -82,15 +82,15 @@ func downloadTailwindCli() {
if os == "windows" { if os == "windows" {
process.RunMany([]string{ process.RunMany([]string{
fmt.Sprintf(`curl -LO %s`, url), fmt.Sprintf(`curl -LO %s`, url),
fmt.Sprintf(`mv %s ./__htmgo/tailwind`, fileName),
}, process.ExitOnError) }, process.ExitOnError)
} else { } else {
process.RunMany([]string{ process.RunMany([]string{
fmt.Sprintf(`curl -LO %s`, url), fmt.Sprintf(`curl -LO %s`, url),
fmt.Sprintf(`chmod +x %s`, fileName), fmt.Sprintf(`chmod +x %s`, fileName),
fmt.Sprintf(`mv %s ./__htmgo/tailwind`, fileName),
}, process.ExitOnError) }, process.ExitOnError)
} }
dirutil.MoveFile(fileName, "./__htmgo/tailwind")
slog.Debug("Successfully downloaded Tailwind CLI", slog.String("url", url)) slog.Debug("Successfully downloaded Tailwind CLI", slog.String("url", url))
} }