Skip to content

Modern Fs HomeDir

Paul Squires edited this page Nov 9, 2026 · 3 revisions

Home › Filesystem › Filesystem Library › HomeDir

HomeDir

Returns the user's home folder, without a trailing separator.

Syntax

HomeDir( )

Notes

  • Windows: the Profile known folder (C:\Users\name), falling back to %USERPROFILE%.
  • Linux and macOS: $HOME when it is set and absolute, otherwise the home directory in the user's passwd entry.
  • Fails with FS_NOT_FOUND when there is no answer at all.

Examples

#import "std/fs"
using fs

dim as ustring home = HomeDir( ).ValueOr( "" )
print IsDir( home )                              '' true
print cbool( PathJoin( home, ".myapprc" ) = ExpandHome( "~/.myapprc" ).ValueOr( "" ) )    '' true

Library: Filesystem Library Category: Filesystem Documented under: Directories

Clone this wiki locally