Skip to content

idleberg/nsis-pathlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PathLib.nsh

A path testing library for NSIS providing LogicLib operators and string transformation macros.

Minimum Requirements

  • NSIS 3.0 (Unicode)

Installation

Download the latest version and run the installer.

Alternatively, clone the respository and copy Includes\* to ${NSISDIR}\Includes.

Usage

!include "PathLib.nsh"

Macros

Path operators

LogicLib operators for use with ${If}, ${IfNot}, ${ElseIf}, ${AndIf}, ${OrIf}, etc.

Macro Example Description
${Path.IsAbsolute} ${If} ${Path.IsAbsolute} $0 Path is absolute (drive letter or UNC)
${Path.IsRelative} ${If} ${Path.IsRelative} $0 Path is relative
${Path.IsUNC} ${If} ${Path.IsUNC} $0 Path is a UNC path (\\server\share)
${Path.IsValid} ${If} ${Path.IsValid} $0 Path contains no forbidden characters
${Path.IsValidFileName} ${If} ${Path.IsValidFileName} $0 Filename contains no forbidden characters
${Path.IsFile} ${If} ${Path.IsFile} $0 Path points to an existing file
${Path.IsDirectory} ${If} ${Path.IsDirectory} $0 Path points to an existing directory
${Path.IsReadable} ${If} ${Path.IsReadable} $0 Path exists and is accessible
${Path.IsWritable} ${If} ${Path.IsWritable} $0 Path exists and is not read-only
${Path.IsHidden} ${If} ${Path.IsHidden} $0 Path exists and has the hidden attribute
${Path.IsSymLink} ${If} ${Path.IsSymLink} $0 Path is a symlink, junction, or mount point

See example for details.

Path transforms

Macro Example Description
${Path.Normalize} ${Path.Normalize} $0 $OutVar Resolves . and .. segments in a path
${Path.Join} ${Path.Join} $0 $1 $OutVar Joins a directory and filename into a single path
${Path.Resolve} ${Path.Resolve} $0 $OutVar Resolves a relative path to absolute using CWD
${Path.Dirname} ${Path.Dirname} $0 $OutVar Returns the directory portion of a path
${Path.Extname} ${Path.Extname} $0 $OutVar Returns the file extension (including the period)
${Path.Basename} ${Path.Basename} $0 ".txt" $OutVar Returns the last portion of a path, minus the suffix

See example for details.

License

The MIT License - Feel free to use, modify, and distribute this code.

About

A path testing library for NSIS providing LogicLib operators and string transformation macros.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages