Skip to content

Commit

Permalink
Merge pull request #23 from chrishrb/20-broken-output
Browse files Browse the repository at this point in the history
20 Hopefully fix broken output by using path instead of filepath (win…
  • Loading branch information
chrishrb authored Dec 23, 2024
2 parents c41887c + f61329f commit 91b686b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ compile: ## Compile for every OS and Platform
GOOS=darwin GOARCH=arm64 go build -o bin/go-grip-darwin-arm64 main.go
GOOS=linux GOARCH=amd64 go build -o bin/go-grip-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o bin/go-grip-linux-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o bin/go-grip-windows-amd64 main.go
GOOS=windows GOARCH=arm64 go build -o bin/go-grip-windows-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o bin/go-grip-windows-amd64.exe main.go
GOOS=windows GOARCH=arm64 go build -o bin/go-grip-windows-arm64.exe main.go

format: ## Format code
${GOCMD} fmt ./...
Expand Down
8 changes: 4 additions & 4 deletions internal/emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"net/http"
"os"
"path/filepath"
"path"
"strings"
"text/template"

Expand Down Expand Up @@ -93,10 +93,10 @@ func downloadIcon(baseDir, url string) (string, error) {

parts := strings.Split(url, "/")
fileName := parts[len(parts)-1]
destPath := filepath.Join(baseDir, fileName)
htmlPath := filepath.Join("/static/emojis", fileName)
destPath := path.Join(baseDir, fileName)
htmlPath := path.Join("/static/emojis", fileName)

if err := os.MkdirAll(filepath.Dir(destPath), os.ModePerm); err != nil {
if err := os.MkdirAll(path.Dir(destPath), os.ModePerm); err != nil {
return "", fmt.Errorf("failed to create directories: %v", err)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"html/template"
"io"
"log"
"path/filepath"
"path"
"regexp"
"strings"

Expand Down Expand Up @@ -219,7 +219,7 @@ func renderHookListItem(w io.Writer, node ast.Node, entering bool) (ast.WalkStat
}

func createBlockquoteStart(alert string) (string, error) {
lp := filepath.Join("templates/alert", fmt.Sprintf("%s.html", alert))
lp := path.Join("templates/alert", fmt.Sprintf("%s.html", alert))
tmpl, err := template.ParseFS(defaults.Templates, lp)
if err != nil {
return "", err
Expand All @@ -241,7 +241,7 @@ func renderMermaid(content string, darkmode bool) (string, error) {
Content: content,
Darkmode: darkmode,
}
lp := filepath.Join("templates/mermaid/mermaid.html")
lp := path.Join("templates/mermaid/mermaid.html")
tmpl, err := template.ParseFS(defaults.Templates, lp)
if err != nil {
return "", err
Expand Down
6 changes: 3 additions & 3 deletions pkg/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"log"
"net/http"
"net/url"
"path/filepath"
"path"
"regexp"
"text/template"

Expand All @@ -22,8 +22,8 @@ type htmlStruct struct {
}

func (client *Client) Serve(file string) error {
directory := filepath.Dir(file)
filename := filepath.Base(file)
directory := path.Dir(file)
filename := path.Base(file)

reload := reload.New(directory)
reload.Log = log.New(io.Discard, "", 0)
Expand Down

0 comments on commit 91b686b

Please sign in to comment.