sanejoin

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package sanejoin implements Join() like filepath.Join(), except when later arguments are absolute, in which case it wipes the previous path components. (Behaves like python os.path.join().)

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(elem ...string) string

Join joins path elements, but will allow absolute paths to wipe previous arguments.

input | filepath | sanejoin | different --------------+--------------+----------+----------- "a", "b" | "a/b" | "a/b" | "a/b", "../c" | "a/c" | "a/c" | "a/b", "/c" | "a/b/c" | "/c" | yes --------------+--------------+----------+-----------

Example
fmt.Println("On Unix:")
fmt.Println(Join("a", "b", "c"))
// expected: a/b/c
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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