Nilesoft Shell Pro GitHub

PATH


path.combine (path.join)

Combines an array of strings into a path.

Syntax

path.combine(path1, path2)
path.combine("C:", "Windows", "Explorer.exe")
path.currentdirectory (path.curdir)

Retrieves the current directory for the current process.

Syntax

path.currentdirectory
path.directory.name (path.dir.name)

Return the directory name from the path.

Syntax

path.directory.name('c:\windows\system32') // returns: system32
path.directory.box (path.dir.box)

Shows the folder selection box and returns the path of the chosen folder, or nothing when it is cancelled. Both arguments are optional: the folder the box opens in, and the text in its title bar.

Syntax

path.directory.box
path.dir.box(sel.dir)
path.dir.box('C:\Projects', 'Pick a project folder')
path.directory.boxl (path.dir.boxl)

The same as path.dir.box, with the older Browse For Folder box, which shows the folders as a tree. The text you give is shown above the tree.

Syntax

path.dir.boxl
path.dir.boxl(sel.dir, 'Pick a project folder')
path.empty

Check if one or more path is empty.

Syntax

path.empty(path)
path.empty(path1, path2, ...)
path.exists

Check if one or more path exists..

Syntax

path.exists(path)
path.exists(path1, path2, ...)
path.absolute

Returns the full path for a relative one, starting from the folder the menu was opened in. It also tidies .. and /. A path that is already full is only tidied. A second argument sets another folder to start from. With no folder to start from (the taskbar menu), a relative path is returned as it is.

Syntax

path.absolute('notes.txt') return "C:\Users\me\Documents\notes.txt" in C:\Users\me\Documents
path.absolute('..\backup') return "C:\Users\me\backup" in C:\Users\me\Documents
path.absolute('notes.txt', 'D:\Work') return "D:\Work\notes.txt"
path.relative

Returns how to get to a path from the folder the menu was opened in, such as ..\Pictures\a.png, or . for that folder itself. A second argument sets another folder to start from. When there is no relative way (the path is on another drive, or longer than 260 characters), the full path is returned.

Syntax

path.relative(sel.path) return "report.docx" for C:\Users\me\Documents\report.docx
path.relative('C:\Users\me\Pictures\a.png') return "..\Pictures\a.png" in C:\Users\me\Documents
path.relative('C:\Windows\System32', 'C:\Windows') return "System32"
path.full

Returns the absolute path for the specified path string.

Syntax

path.full(path)
path.short

Retrieves the short path form of the specified path.

Syntax

path.short(path)
path.name

Return the name from the path.

Syntax

path.name(path)
path.location (path.parent)

Return the path of the parent

Syntax

path.location(path)
path.location.name

Return the name from the parent

Syntax

path.location.name(path)
path.root

Return the drive path

Syntax

path.root(path)
path.title

Return the title from the path

Syntax

path.title(path)
path.type

Return the type of path

Syntax

path.type(path) == type.file
path.file.name

Return the name of path

Syntax

path.file.name(path)
path.file.title

Return the name of path without extension

Syntax

path.file.title(path)
path.file.ext

Return the extension of path

Syntax

path.file.ext(path)
path.file.box

Shows the Open box and returns the path of the chosen file, or nothing when it is cancelled. The arguments are optional: the file types to offer, the folder the box opens in, and a file name to fill in.

File types are pairs of a label and a pattern, separated by |, such as 'Text|*.txt|All|*.*'. Several patterns go in one pair with ;, as in 'Images|*.png;*.jpg'. They can also be given as an array, such as ['Text|*.txt', 'All|*.*'].

Syntax

path.file.box
path.file.box('All|*.*|Text|*.txt')
path.file.box('exe|*.exe', 'c:\windows')
path.file.box('exe|*.exe', 'c:\windows', 'explorer.exe')
path.file.box(['Text|*.txt', 'All|*.*'], sel.dir)
path.file.save_box

Shows the Save As box and returns the path the user chose, or nothing when it is cancelled. It asks before replacing a file that is already there. It doesn't create or write the file itself.

The arguments are the same as for path.file.box: the file types, the folder the box opens in, and a suggested file name. When the user types a name without an extension, the extension of the first file type is added (.txt for 'Text|*.txt').

Syntax

path.file.save_box
path.file.save_box('Text|*.txt|All|*.*')
path.file.save_box('Text|*.txt', user.desktop, 'list.txt')
path.files

Returns all files with the ability to filter.

Syntax

path.files(sys.dir, ["*"], flags[2=files | 3=dirs | 5=files+dirs | 8=quots | 16=full path], sep)
	
// get all files and dirs
path.files(sys.dir)
path.files(sys.dir, "*")

// get all files with .exe
path.files(sys.dir,"*.exe")

// full path + quots
path.files(sys.dir, '*', 8|16)
	
path.isabsolute

Syntax

path.isabsolute(path)
path.isrelative

Syntax

path.isrelative(path)
path.isfile

Syntax

path.isfile(path)
path.isdirectory

Syntax

path.isdirectory(path)
path.isroot (path.isdrive)

Syntax

path.isdrive(path)
path.isclsid (path.isnamespace)

Syntax

path.isclsid(path)
path.isexe

Syntax

path.isexe(path)
path.removeextension

Remove the extension from the passed parameter.

Syntax

path.removeextension
path.lnk

Return a path from the shortcut

Syntax

path.lnk(path)
path.lnk.type

Return type from the shortcut

Syntax

path.lnk.type(path)
path.lnk.dir

Return a dir path from the shortcut

Syntax

path.lnk.dir(path)
path.lnk.icon

Return a icon path and index from the shortcut

Syntax

path.lnk.icon(path)
path.lnk.args

Returns the arguments of the shortcut, or nothing when it has none.

Syntax

path.lnk.args(path)
path.lnk.raw

Returns the target of the shortcut followed by its arguments, as one command line. The target is put in quotes when it has spaces.

Syntax

path.lnk.raw(path)

Example

path.lnk.raw('C:\Users\Public\Desktop\App.lnk')
// result:
// "C:\Program Files\App\app.exe" --profile work
path.getknownfolder

Retrieves the full path of a known folder identified.

Syntax

path.getknownfolder('{905e63b6-c1bf-494e-b29c-65b732d3d21a}')
path.separator(path.sep)

Replacing the back slash with a forward slash or defining a spacer.

Syntax

path.separator('c:\windows\system32') return "c:/windows/system32"
path.separator('c:\windows\system32', '#') return "c:#windows#system32"
path.wsl

convert the path to wsl path