Skip to content

Commit

Permalink
Support system path systems everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
amanjpro committed Dec 3, 2024
1 parent da18aa6 commit 8c0db95
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion pkg/cmd/cli/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ func (c *CreateCmd) Run(cli *CliContext) error {
fmt.Println("The following key has been generated and saved to: ", cli.config.configPath)
} else {
conf = cli.config.keyConfig
fmt.Printf("Key already exists at: %s. Use --force to overwrite.\n", cli.config.configPath)
fmt.Printf(`Key already exists at: %s.
!!CAUTION!!
You may overwrite this existing key but this action is irreversible and may invalidate any PAIR clean rooms that are currently in progress. Use --force to proceed with overwriting.
`, cli.config.configPath)
}

return nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"optable-pair-cli/pkg/cmd/cli"
"path/filepath"

"github.com/adrg/xdg"
"github.com/alecthomas/kong"
Expand All @@ -24,7 +25,7 @@ https://github.com/Optable/match/blob/main/pkg/pair/README.md and
https://iabtechlab.com/pair/
`

const keyConfigPath = "opair/key/key.json"
var keyConfigPath = filepath.Join("opair", "key", "key.json")

func main() {
var c cli.Cli
Expand Down
5 changes: 3 additions & 2 deletions pkg/pair/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"optable-pair-cli/pkg/io"
"optable-pair-cli/pkg/keys"
"os"
"path/filepath"
"runtime"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -109,8 +110,8 @@ func (w *writer) NewWriter(index int) (*csv.Writer, error) {
return csv.NewWriter(os.Stdout), nil
}

p := strings.TrimRight(w.path, "/")
f, err := os.Create(fmt.Sprintf("%s/result_%d.csv", p, index))
p := strings.TrimRight(w.path, string(filepath.Separator))
f, err := os.Create(filepath.Join(p, fmt.Sprintf("result_%d.csv", index)))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 8c0db95

Please sign in to comment.