Switch from path to filepath package

This commit is contained in:
2026-04-26 22:50:32 +03:00
parent 5e6362074e
commit 6a701dd311
3 changed files with 16 additions and 16 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ package main
import (
"log"
"os"
"path"
"path/filepath"
"runtime"
"gopkg.in/yaml.v3"
@@ -44,11 +44,11 @@ func readConfig() {
configPaths := make([]string, 0)
if runtime.GOOS == "windows" {
configPaths = append(configPaths, path.Join(homeDir, "AppData/Roaming/Typer/config.yml"))
configPaths = append(configPaths, path.Join(path.Dir(execPath), "etc/typer/config.yml"))
configPaths = append(configPaths, filepath.Join(homeDir, "AppData/Roaming/Typer/config.yml"))
configPaths = append(configPaths, filepath.Join(filepath.Dir(execPath), "etc/typer/config.yml"))
} else {
configPaths = append(configPaths, path.Join(homeDir, ".config/typer/config.yml"))
configPaths = append(configPaths, path.Join(sysconfdir, "typer/config.yml"))
configPaths = append(configPaths, filepath.Join(homeDir, ".config/typer/config.yml"))
configPaths = append(configPaths, filepath.Join(sysconfdir, "typer/config.yml"))
}
for _, configPath := range configPaths {
+5 -5
View File
@@ -3,7 +3,7 @@ package main
import (
"log"
"os"
"path"
"path/filepath"
"runtime"
"strings"
@@ -40,11 +40,11 @@ func readKeybindings() {
configPaths := make([]string, 0)
if runtime.GOOS == "windows" {
configPaths = append(configPaths, path.Join(homeDir, "AppData/Roaming/Typer/keybindings.yml"))
configPaths = append(configPaths, path.Join(path.Dir(execPath), "etc/typer/keybindings.yml"))
configPaths = append(configPaths, filepath.Join(homeDir, "AppData/Roaming/Typer/keybindings.yml"))
configPaths = append(configPaths, filepath.Join(filepath.Dir(execPath), "etc/typer/keybindings.yml"))
} else {
configPaths = append(configPaths, path.Join(homeDir, ".config/typer/keybindings.yml"))
configPaths = append(configPaths, path.Join(sysconfdir, "typer/keybindings.yml"))
configPaths = append(configPaths, filepath.Join(homeDir, ".config/typer/keybindings.yml"))
configPaths = append(configPaths, filepath.Join(sysconfdir, "typer/keybindings.yml"))
}
for _, configPath := range configPaths {
+6 -6
View File
@@ -4,7 +4,7 @@ import (
"fmt"
"log"
"os"
"path"
"path/filepath"
"reflect"
"runtime"
"slices"
@@ -85,11 +85,11 @@ func readStyles() {
stylesPaths := make([]string, 0)
if runtime.GOOS == "windows" {
stylesPaths = append(stylesPaths, path.Join(homeDir, "AppData/Roaming/Typer/styles"))
stylesPaths = append(stylesPaths, path.Join(path.Dir(execPath), "etc/typer/styles"))
stylesPaths = append(stylesPaths, filepath.Join(homeDir, "AppData/Roaming/Typer/styles"))
stylesPaths = append(stylesPaths, filepath.Join(filepath.Dir(execPath), "etc/typer/styles"))
} else {
stylesPaths = append(stylesPaths, path.Join(homeDir, ".config/typer/styles"))
stylesPaths = append(stylesPaths, path.Join(sysconfdir, "typer/styles"))
stylesPaths = append(stylesPaths, filepath.Join(homeDir, ".config/typer/styles"))
stylesPaths = append(stylesPaths, filepath.Join(sysconfdir, "typer/styles"))
}
for _, stylesPath := range stylesPaths {
@@ -107,7 +107,7 @@ func readStyles() {
// Read entries in directory
for _, entry := range entries {
entryPath := path.Join(stylesPath, entry.Name())
entryPath := filepath.Join(stylesPath, entry.Name())
style, err := readStyleYamlFile(entryPath)
if err != nil {