Documentation ¶
Index ¶
- func Cleanup(path string)
- func Exists(path string) (bool, error)
- func ForceLongPathTempDir()
- func ForceSymlink(oldname, newname string) error
- func IsBelow(path string, root string) (bool, error)
- func IsDir(path string) bool
- func IsSharedLibrary(path string) bool
- func IsSymlink(path string) bool
- func IsSystemLibrary(library string) bool
- func PrettifyPath(path string) string
- func SearchFileBackwards(start, filename string) (string, error)
- func Touch(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶
func Cleanup(path string)
Cleanup removes the specified file or directory and prints any errors to stderr. It's supposed to be used in defer statements to clean up temporary directories.
func ForceLongPathTempDir ¶ added in v0.11.1
func ForceLongPathTempDir()
ForceLongPathTempDir ensures that os.TempDir() creates temporary directories with long paths on Windows, resolving all "8.3" style short names. This is necessary because some external tools automatically resolve short paths to long paths, which can cause problems when trying to relativize paths.
We prevent this issue by forcing long paths in os.TempDir() rather than normalizing paths whenever we relativize them for the following reasons:
- Go does not provide a function that normalizes paths without following symlinks, so we would have to implement it ourselves.
- The temporary directories we create in cifuzz appear to be the only common source of 8.3 paths and users are very unlikely to launch cifuzz from an 8.3 path.
func ForceSymlink ¶ added in v0.7.0
ForceSymlink creates newname as a symbolic link to oldname. If newname already exists, it will be overwritten.
func IsBelow ¶
IsBelow returns true if and only if path lies below or is the path root. path and root must be either both absolute or both relative.
func IsDir ¶
IsDir returns whether this path is a directory. Tries to behave the same as Python's pathlib.Path.is_dir()
func IsSharedLibrary ¶ added in v0.20.0
func IsSystemLibrary ¶ added in v0.20.0
func PrettifyPath ¶
PrettifyPath prints a possibly shortened path for display purposes. If path is located under the current working directory, the relative path to it is returned, otherwise or in case of an error the path is returned unchanged.
func SearchFileBackwards ¶ added in v0.20.0
SearchFileBackwards searches for a file by going backwards/upwards from a given path if a path `/foo/bar` is given the order of search is
- /foo/bar
- /foo/
- /
Types ¶
This section is empty.