Skip to content

ntpath ​

Path operations for Windows/NT-style paths.

πŸ’‘Python ntpath-style behavior, ported to Lua.

Usage ​

lua
ntpath = require "mods.ntpath"

print(ntpath.join([[C:\]], "Users", "me"))    --> "C:\Users\me"
print(ntpath.normcase([[A/B\C]]))             --> [[a\b\c]]
print(ntpath.splitdrive([[C:\Users\me]]))     --> "C:", [[\Users\me]]
print(ntpath.isreserved([[C:\Temp\CON.txt]])) --> true

✨ Same API as mods.path, but with Windows/NT path semantics.

Functions ​

ismount(path) ​

Return true when path points to a mount root.

Parameters:

  • path (string): Path to inspect.

Return:

  • isMount (boolean): true if the path resolves to a mount root.

Example:

lua
ntpath.ismount([[C:\]]) --> true

isreserved(path) ​

Return true when path contains a reserved NT filename.

Parameters:

  • path (string): Path to inspect.

Return:

  • isReserved (boolean): true if any component is NT-reserved.

Example:

lua
ntpath.isreserved([[a\CON.txt]]) --> true