From MiniScript Wiki
Jump to navigation Jump to search

In Mini Micro and command-line MiniScript, the file.child function combines a parent path with a child subpath or file name.

See also: file.children


Parameter Name Meaning
basePath absolute or relative parent path (with or without a trailing path separator)
subpath partial path or file name

Usage Notes

This method will insert the correct path separator for the platform it's running on. On Linux, Mac OS, and Mini Micro, the path separator is a forward slash (/); but on Windows it is a backslash (\). By using this method instead of combining path parts manually, you can avoid hard-coding a particular path separator, and so write more portable code.

file.child will also correctly handle the case where the base path ends in a path separator, i.e., it only adds a path separator when one is needed.


This prints the full path to a file called "test.txt" in the current directory.

print file.child(file.curdir, "test.txt")

The exact output of the above depends on the platform and the current working directory. For example, if you are on Mini Micro and in the default /usr directory, then this prints /usr/test.txt.