rclone: github.com/ncw/rclone/fs/fspath Index | Files

package fspath

import "github.com/ncw/rclone/fs/fspath"

Package fspath contains routines for fspath manipulation


Package Files


func CheckConfigName Uses

func CheckConfigName(configName string) error

CheckConfigName returns an error if configName is invalid

func CheckRemoteName Uses

func CheckRemoteName(remoteName string) error

CheckRemoteName returns an error if remoteName is invalid

func JoinRootPath Uses

func JoinRootPath(elem ...string) string

JoinRootPath joins any number of path elements into a single path, adding a separating slash if necessary. The result is Cleaned; in particular, all empty strings are ignored.

If the first non empty element has a leading "//" this is preserved.

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

func Parse Uses

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 Uses

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 /)

Package fspath imports 6 packages (graph) and is imported by 13 packages. Updated 2020-09-18. Refresh now. Tools for package owners.