Skip to content

Commit 2af8dcd

Browse files
committed
fix: use filepath instead of path
1 parent 24730f0 commit 2af8dcd

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

commands/copy.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package commands
22

33
import (
44
"os"
5-
"path"
5+
"path/filepath"
66

77
"github.com/kldzj/pzmod/config"
88
"github.com/kldzj/pzmod/util"
@@ -16,11 +16,11 @@ func cmdCopyConfig() *cobra.Command {
1616
Args: cobra.ExactArgs(1),
1717
Run: func(cmd *cobra.Command, args []string) {
1818
config := config.UnsafeLoadConfig(cmd)
19-
saveTo := path.Clean(args[0])
20-
if !path.IsAbs(saveTo) {
19+
saveTo := filepath.Clean(args[0])
20+
if !filepath.IsAbs(saveTo) {
2121
cwd, err := os.Getwd()
2222
cobra.CheckErr(err)
23-
saveTo = path.Join(cwd, saveTo)
23+
saveTo = filepath.Join(cwd, saveTo)
2424
}
2525

2626
if util.FileExists(saveTo) {

ini/ini.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ini
33
import (
44
"fmt"
55
"os"
6-
"path"
6+
"path/filepath"
77
"strings"
88

99
"github.com/kldzj/pzmod/eol"
@@ -22,13 +22,13 @@ type ServerConfig struct {
2222
}
2323

2424
func NewServerConfig(configPath string) (*ServerConfig, error) {
25-
if !path.IsAbs(configPath) {
25+
if !filepath.IsAbs(configPath) {
2626
cwd, err := os.Getwd()
2727
if err != nil {
2828
return nil, fmt.Errorf("failed to get current working directory: %w", err)
2929
}
3030

31-
configPath = path.Join(cwd, configPath)
31+
configPath = filepath.Join(cwd, configPath)
3232
}
3333

3434
return &ServerConfig{Path: configPath, EOL: eol.OSDefault().String()}, nil

interactive/file-save.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package interactive
22

33
import (
44
"os"
5-
"path"
5+
"path/filepath"
66

77
"github.com/AlecAivazis/survey/v2"
88
"github.com/kldzj/pzmod/ini"
@@ -33,14 +33,14 @@ func cmdSaveConfigTo(cmd *cobra.Command, config *ini.ServerConfig) {
3333
return
3434
}
3535

36-
if !path.IsAbs(configPath) {
36+
if !filepath.IsAbs(configPath) {
3737
cwd, err := os.Getwd()
3838
if err != nil {
3939
cmd.Println(util.Error, err)
4040
return
4141
}
4242

43-
configPath = path.Join(cwd, configPath)
43+
configPath = filepath.Join(cwd, configPath)
4444
}
4545

4646
if util.IsDir(configPath) {

0 commit comments

Comments
 (0)