Skip to content

Commit 333770b

Browse files
authored
Merge pull request zyedidia#3727 from JoeKar/fix/path2filepath
Convert leftover usages of `path` to `filepath`
2 parents e5c3a3e + 7e583fe commit 333770b

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

internal/buffer/buffer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"io"
1010
"io/fs"
1111
"os"
12-
"path"
1312
"path/filepath"
1413
"strconv"
1514
"strings"
@@ -479,7 +478,7 @@ func (b *Buffer) GetName() string {
479478
name = b.Path
480479
}
481480
if b.Settings["basename"].(bool) {
482-
return path.Base(name)
481+
return filepath.Base(name)
483482
}
484483
return name
485484
}

internal/config/rtfiles.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"errors"
55
"log"
66
"os"
7-
"path"
87
"path/filepath"
98
"regexp"
109
"strings"
@@ -84,8 +83,8 @@ func (rf realFile) Data() ([]byte, error) {
8483
}
8584

8685
func (af assetFile) Name() string {
87-
fn := path.Base(string(af))
88-
return fn[:len(fn)-len(path.Ext(fn))]
86+
fn := filepath.Base(string(af))
87+
return fn[:len(fn)-len(filepath.Ext(fn))]
8988
}
9089

9190
func (af assetFile) Data() ([]byte, error) {
@@ -125,8 +124,8 @@ func AddRuntimeFilesFromAssets(fileType RTFiletype, directory, pattern string) {
125124

126125
assetLoop:
127126
for _, f := range files {
128-
if ok, _ := path.Match(pattern, f); ok {
129-
af := assetFile(path.Join(directory, f))
127+
if ok, _ := filepath.Match(pattern, f); ok {
128+
af := assetFile(filepath.Join(directory, f))
130129
for _, rf := range realFiles[fileType] {
131130
if af.Name() == rf.Name() {
132131
continue assetLoop
@@ -167,7 +166,7 @@ func InitRuntimeFiles(user bool) {
167166
if user {
168167
AddRuntimeFilesFromDirectory(fileType, filepath.Join(ConfigDir, dir), pattern)
169168
}
170-
AddRuntimeFilesFromAssets(fileType, path.Join("runtime", dir), pattern)
169+
AddRuntimeFilesFromAssets(fileType, filepath.Join("runtime", dir), pattern)
171170
}
172171

173172
initRuntimeVars()
@@ -300,7 +299,7 @@ func PluginAddRuntimeFile(plugin string, filetype RTFiletype, filePath string) e
300299
if _, err := os.Stat(fullpath); err == nil {
301300
AddRealRuntimeFile(filetype, realFile(fullpath))
302301
} else {
303-
fullpath = path.Join("runtime", "plugins", pldir, filePath)
302+
fullpath = filepath.Join("runtime", "plugins", pldir, filePath)
304303
AddRuntimeFile(filetype, assetFile(fullpath))
305304
}
306305
return nil
@@ -317,7 +316,7 @@ func PluginAddRuntimeFilesFromDirectory(plugin string, filetype RTFiletype, dire
317316
if _, err := os.Stat(fullpath); err == nil {
318317
AddRuntimeFilesFromDirectory(filetype, fullpath, pattern)
319318
} else {
320-
fullpath = path.Join("runtime", "plugins", pldir, directory)
319+
fullpath = filepath.Join("runtime", "plugins", pldir, directory)
321320
AddRuntimeFilesFromAssets(filetype, fullpath, pattern)
322321
}
323322
return nil

internal/lua/lua.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ func importPath() *lua.LTable {
427427
func importFilePath() *lua.LTable {
428428
pkg := L.NewTable()
429429

430-
L.SetField(pkg, "Join", luar.New(L, filepath.Join))
431430
L.SetField(pkg, "Abs", luar.New(L, filepath.Abs))
432431
L.SetField(pkg, "Base", luar.New(L, filepath.Base))
433432
L.SetField(pkg, "Clean", luar.New(L, filepath.Clean))

0 commit comments

Comments
 (0)