From 5c1161f2279d053a4ec72a311ca6c86f5ee9749d Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Mon, 18 Dec 2023 09:21:26 +0100 Subject: [PATCH 1/3] fix #4, use filepath.Join to create portable path's --- scrape.go | 3 ++- store.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scrape.go b/scrape.go index fb83b80..5facc46 100644 --- a/scrape.go +++ b/scrape.go @@ -23,6 +23,7 @@ import ( "io" "log/slog" "net/http" + "path/filepath" "strings" "sync" @@ -176,7 +177,7 @@ func ScrapeImages(dir string, ad *Ad) error { failure := make(chan string) for _, imguri := range ad.Images { - file := fmt.Sprintf("%s/%d.jpg", dir, img) + file := filepath.Join(dir, ad.Slug, fmt.Sprintf("%d.jpg", img)) go func() { defer wg.Done() err := Getimage(imguri, file) diff --git a/store.go b/store.go index 17c25c9..7c4806f 100644 --- a/store.go +++ b/store.go @@ -21,20 +21,21 @@ import ( "io" "log/slog" "os" + "path/filepath" "strings" tpl "text/template" ) func WriteAd(dir string, ad *Ad, template string) error { // prepare output dir - dir = dir + "/" + ad.Slug + dir = filepath.Join(dir, ad.Slug) err := Mkdir(dir) if err != nil { return err } // write ad file - listingfile := strings.Join([]string{dir, "Adlisting.txt"}, "/") + listingfile := filepath.Join(dir, "Adlisting.txt") f, err := os.Create(listingfile) if err != nil { return err From 4a528ad9d15a1d93a3ec9e405a91dcf9a9347059 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Mon, 18 Dec 2023 09:22:08 +0100 Subject: [PATCH 2/3] fix #5: add exe extension to built windows binaries --- mkrel.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkrel.sh b/mkrel.sh index d246fce..b47c180 100755 --- a/mkrel.sh +++ b/mkrel.sh @@ -40,6 +40,11 @@ for D in $DIST; do os=${D/\/*/} arch=${D/*\//} binfile="releases/${tool}-${os}-${arch}-${version}" + + if test "$os" = "windows"; then + binfile="${binfile}.exe" + fi + tardir="${tool}-${os}-${arch}-${version}" tarfile="releases/${tool}-${os}-${arch}-${version}.tar.gz" set -x From f1908f02cbd7203f91b597ceff7d86a5ce3e48e5 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Mon, 18 Dec 2023 09:23:18 +0100 Subject: [PATCH 3/3] bump version --- config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.go b/config.go index 7796561..06f42b8 100644 --- a/config.go +++ b/config.go @@ -23,7 +23,7 @@ import ( ) const ( - VERSION string = "0.0.4" + VERSION string = "0.0.5" Baseuri string = "https://www.kleinanzeigen.de" Listuri string = "/s-bestandsliste.html" Defaultdir string = "."