fspath

package
v1.54.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 6 Imported by: 59

Documentation

Overview

Package fspath contains routines for fspath manipulation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfigName added in v1.50.0

func CheckConfigName(configName string) error

CheckConfigName returns an error if configName is invalid

func CheckRemoteName added in v1.50.0

func CheckRemoteName(remoteName string) error

CheckRemoteName returns an error if remoteName is invalid

func JoinRootPath

func JoinRootPath(remote, filePath string) string

JoinRootPath joins filePath onto remote

If the remote has a leading "//" this is preserved to allow Windows network paths to be used as remotes.

If filePath is empty then remote will be returned.

If the path contains \ these will be converted to / on Windows.

func Parse

func Parse(path string) (configName, fsPath string, err error)

Parse deconstructs a remote path into configName and fsPath

If the path is a local path then configName will be returned as "".

So "remote:path/to/dir" will return "remote", "path/to/dir" and "/path/to/local" will return ("", "/path/to/local")

Note that this will turn \ into / in the fsPath on Windows

An error may be returned if the remote name has invalid characters in it or if the path is empty.

func Split

func Split(remote string) (parent string, leaf string, err error)

Split splits a remote into a parent and a leaf

if it returns leaf as an empty string then remote is a directory

if it returns parent as an empty string then that means the current directory

The returned values have the property that parent + leaf == remote (except under Windows where \ will be translated into /)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL