Skip to content

Commit

Permalink
always prefer config file location in user home dir
Browse files Browse the repository at this point in the history
  • Loading branch information
sagan committed Dec 18, 2023
1 parent 0998041 commit 5e3482e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ func Execute() {

func init() {
UserHomeDir, _ := os.UserHomeDir()
configFile := "ptool.toml"
configFile := filepath.Join(UserHomeDir, ".config/ptool/ptool.toml")
configFiles := []string{
filepath.Join(UserHomeDir, ".config/ptool/ptool.toml"),
configFile,
filepath.Join(UserHomeDir, ".config/ptool/ptool.yaml"),
"ptool.toml",
"ptool.yaml",
}
for _, cf := range configFiles {
_, err := os.Stat(cf)
if err == nil {
if err == nil || !os.IsNotExist(err) {
configFile = cf
break
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/versioncmd/versioncmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func versioncmd(cmd *cobra.Command, args []string) error {
fmt.Printf("- os/type: %s\n", runtime.GOOS)
fmt.Printf("- os/arch: %s\n", runtime.GOARCH)
fmt.Printf("- go/version: %s\n", runtime.Version())
fmt.Printf("- config/default_tls_ja3: %s\n", util.CHROME_JA3)
fmt.Printf("- config/default_h2_fingerprint: %s\n", util.CHROME_H2FINGERPRINT)
fmt.Printf("- config/default_http_request_headers:\n")
for _, header := range util.CHROME_HTTP_REQUEST_HEADERS {
value := header[1]
Expand Down

0 comments on commit 5e3482e

Please sign in to comment.