MCPcopy
hub / github.com/SurgeDM/Surge / EnsureAbsPath

Function EnsureAbsPath

internal/utils/path.go:11–19  ·  view source on GitHub ↗

EnsureAbsPath takes a clean path and forces it to be absolute. If it fails to get absolute path (rare), it checks if it's already absolute, otherwise relies on the input.

(path string)

Source from the content-addressed store, hash-verified

9// If it fails to get absolute path (rare), it checks if it's already absolute,
10// otherwise relies on the input.
11func EnsureAbsPath(path string) string {
12 if path == "" {
13 path = "."
14 }
15 if abs, err := filepath.Abs(path); err == nil {
16 return abs
17 }
18 return path
19}
20
21// IsWindowsAbsPath reports whether p looks like a Windows absolute path even
22// when running on a non-Windows host (for example inside Docker on Linux).

Callers 13

startDownloadMethod · 0.92
isDefaultDownloadPathMethod · 0.92
addMethod · 0.92
GetCategoryPathFunction · 0.92
resolveClientOutputPathFunction · 0.92
isExplicitOutputPathFunction · 0.92
handleBatchDownloadFunction · 0.92
resolveDownloadRequestFunction · 0.92
processDownloadsFunction · 0.92

Calls

no outgoing calls