2022-08-24 22:10:51 +02:00

20 lines
486 B
Go

//go:build windows
package processors
import (
"path/filepath"
"regexp"
"strings"
)
var separatorToReplace = regexp.QuoteMeta(string(filepath.Separator))
// normalizePathInRegex normalizes path in regular expressions.
// noop on Unix.
// This replacing should be safe because "/" are disallowed in Windows
// https://docs.microsoft.com/windows/win32/fileio/naming-a-file
func normalizePathInRegex(path string) string {
return strings.ReplaceAll(path, "/", separatorToReplace)
}