pathutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathutil provides path validation utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDirectoryWritable

func CheckDirectoryWritable(path string) error

CheckDirectoryWritable checks if a directory exists and is writable. If the directory doesn't exist, it attempts to create it.

func CheckFileDirectoryWritable

func CheckFileDirectoryWritable(filePath string, fileType string) error

CheckFileDirectoryWritable checks if the directory containing a file path is writable.

func JoinAbsPath

func JoinAbsPath(basePath, otherPath string) string

JoinAbsPath safely joins a base path with another path (which could be absolute or relative). If the second path is absolute and starts with the base path, it returns the second path as is. Otherwise, it joins them normally.

func NormalizeLibraryPath

func NormalizeLibraryPath(relPath string, completeDir string, category string) string

NormalizeLibraryPath builds a clean absolute library path by combining prefix segments. It handles stripping existing prefixes from the input path to prevent duplication.

func RemoveEmptyDirs

func RemoveEmptyDirs(root, path string)

RemoveEmptyDirs recursively removes empty parent directories starting from 'path' up towards 'root' (exclusive). It stops if it encounters a non-empty directory or reaches the root.

Types

This section is empty.

Jump to

Keyboard shortcuts

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