Skip to content

Modern Fs PathJoin

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

Home › Filesystem › Filesystem Library › PathJoin

PathJoin

Joins two to four path parts with one separator; an absolute part drops those before it.

Syntax

PathJoin( a, b )

Notes

  • also 3- and 4-argument forms

Examples

#import "std/fs"
using fs

print PathJoin( "C:\dev", "src" )         '' C:\dev\src

'' A separator is inserted only where one is needed, so joining does not
'' double it
print PathJoin( "C:\dev\", "src" )       '' C:\dev\src

'' Three- and four-argument forms exist, so a nested path needs one call
print PathJoin( "C:\dev", "src", "inc" )              '' C:\dev\src\inc
print PathJoin( "C:\dev", "src", "inc", "fb" )        '' C:\dev\src\inc\fb

'' An ABSOLUTE second argument replaces rather than appends
print PathJoin( "C:\dev", "D:\other" )   '' D:\other

Library: Filesystem Library
Category: Filesystem
Documented under: Paths

Clone this wiki locally