Skip to content

Modern Fs PathRoot

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Filesystem › Filesystem Library › PathRoot

PathRoot

Returns the root of a path, such as C:\ or /, or an empty string for a relative path.

Syntax

PathRoot( p )

Notes

  • "C:", "\srv\share", "/", "" -- see below

Examples

#import "std/fs"
using fs

print PathRoot( "C:\dev\src" )            '' C:\
print PathRoot( "\\srv\share\dir" )      '' \\srv\share\
print PathRoot( "relative\path" )        '' (empty) -- no root at all

'' A UNC share is the root, not just the server: \\srv alone is not a
'' place you can be

Library: Filesystem Library
Category: Filesystem
Documented under: Paths

Clone this wiki locally