pathutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pathutil 提供路径处理工具:~ 展开、root 归一化校验,以及默认根目录探测。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectDefaultRoot

func DetectDefaultRoot() string

DetectDefaultRoot 在未指定 root 时,尝试为 macOS/开发者环境提供“开箱即用”的默认根目录: 1) 优先使用 ~/Projects 2) 其次使用 ~/IdeaProjects 3) 都不存在则回退到当前目录 "."

func ExpandTilde

func ExpandTilde(path string) (string, error)

ExpandTilde 将以 "~" 或 "~/"(含 Windows 的 "~\\")开头的路径展开为用户 HOME 目录。

func NormalizeRoot

func NormalizeRoot(root string) (string, error)

NormalizeRoot 负责 root 路径的归一化与校验: 1) 展开 ~ 2) Clean + Abs 3) 校验存在且为目录

Types

This section is empty.

Jump to

Keyboard shortcuts

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