mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-21 23:54:17 +02:00
use strings.TrimPrefix instead of Replace when checking paths
This commit is contained in:
parent
9903ea8dcf
commit
f8fa5a04dc
1 changed files with 1 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ import (
|
|||
// in a dot directory and browsing files beneath this function won't return
|
||||
// true every time.
|
||||
func isDotFileOrDir(cwd, path string) bool {
|
||||
p := strings.Replace(path, cwd, "", 1)
|
||||
p := strings.TrimPrefix(path, cwd)
|
||||
for _, v := range strings.Split(p, string(os.PathSeparator)) {
|
||||
if len(v) > 0 && v[0] == '.' {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue