Skip to content

Modern Fs PathAddExtension

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

Home › Filesystem › Filesystem Library › PathAddExtension

PathAddExtension

Adds an extension after any already there, so a.tar becomes a.tar.gz.

Syntax

PathAddExtension( p, ext [, gram ] )

Notes

  • Adds ext after any extension already there; PathChangeExtension replaces it instead.
  • A leading dot in ext is not doubled. A trailing separator does not hide the name: "dir/" becomes "dir.gz". An empty ext, or a path with no file name, comes back unchanged.

Examples

#import "std/fs"
using fs

print PathAddExtension( "data.tar", "gz", FB_PATH_POSIX )         '' data.tar.gz
print PathChangeExtension( "data.tar", "gz", FB_PATH_POSIX )      '' data.gz

Library: Filesystem Library Category: Filesystem Documented under: Paths

Clone this wiki locally