fs.combine

From ComputerCraft
Jump to: navigation, search

fs.combine
Function
Syntax
fs.combine()
Returns string
API fs
Source CC:Tweaked (source)

Concatenates path pathA with path pathB, such that pathB appears after pathA. A naïve implementation of this function would be pathA .. "/" .. pathB. fs.combine should always be preferred over such a pattern, as this function will take care of special cases, such as when pathB starts with a forward slash, and typeA ends with a forward slash. The naïve implementation would generate three forward slashes between the paths.

ExampleExampleCreating a path to a directory within the ROM directory
Prints the combination of the paths /rom and /dir/test.
Code
print(fs.combine("/rom", "/dir/test"))
Output rom/dir/test