mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-19 15:27:20 +09:00
Fix path escaping on Windows
Windows does not allow ':' in a path, but for some reason previous versions still worked, except the file for storing buffer info (which had a ':' in the name) was not viewable except by opening it with micro. Ref #1736
This commit is contained in:
@@ -336,6 +336,10 @@ func GetModTime(path string) (time.Time, error) {
|
||||
// EscapePath replaces every path separator in a given path with a %
|
||||
func EscapePath(path string) string {
|
||||
path = filepath.ToSlash(path)
|
||||
if runtime.GOOS == "windows" {
|
||||
// ':' is not valid in a path name on Windows but is ok on Unix
|
||||
path = strings.Replace(path, ":", "%", -1)
|
||||
}
|
||||
return strings.Replace(path, "/", "%", -1)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user