Compare commits
2 Commits
885f92aa0f
...
307e494f68
Author | SHA1 | Date | |
---|---|---|---|
307e494f68 | |||
38b833582a |
35
main.go
35
main.go
@@ -32,6 +32,11 @@ func init() {
|
||||
log.Lmicroseconds|log.Lshortfile)
|
||||
}
|
||||
|
||||
// I actually don't even know if this works or not.........
|
||||
// Changes can be seen in windows system properties fucking thing
|
||||
// But not in new terminals
|
||||
// And rerunning the program even with a new terminal will result in the same output as the first run
|
||||
// I really don't know whether or not this worked... And I don't know how to check
|
||||
func main() {
|
||||
currentPath := os.Getenv("PATH")
|
||||
paths := strings.Split(currentPath, ";")
|
||||
@@ -75,9 +80,35 @@ func main() {
|
||||
}
|
||||
|
||||
for _, path := range alwaysInclude {
|
||||
if !contains(cleanPaths, path) {
|
||||
cleanPaths = append(cleanPaths, path)
|
||||
path = filepath.Clean(path)
|
||||
if !filepath.IsAbs(path) {
|
||||
var err error
|
||||
path, err = filepath.Abs(path)
|
||||
if err != nil {
|
||||
Error.Printf("error getting absolute path for %v: %v", path, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
path = filepath.FromSlash(path)
|
||||
|
||||
fhandle, err := os.Open(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
Warning.Printf("Path %v does not exist", path)
|
||||
continue
|
||||
}
|
||||
Warning.Printf("Error opening path %v: %v", path, err)
|
||||
continue
|
||||
}
|
||||
fhandle.Close()
|
||||
|
||||
if slices.Contains(cleanPaths, path) {
|
||||
Warning.Printf("Path %v already exists in cleanPaths", path)
|
||||
continue
|
||||
}
|
||||
|
||||
cleanPaths = append(cleanPaths, path)
|
||||
log.Printf("Added path %v", path)
|
||||
}
|
||||
|
||||
newPath := strings.Join(cleanPaths, ";")
|
||||
|
Reference in New Issue
Block a user