HolyLib Wiki

FullPathToRelativePath

  string filesystem.FullPathToRelativePath( string filePath, string gamePath = nil )

Description

Returns the relative path of the given file/folder.

Arguments

1string filePath
the file/folder path to use
2string gamePath = nil
game path that the given file/folder is inside

Returns

1string relativePath
Returns the relative path or nil on failure

Example

-- The "MOD_WRITE" game path has a single searchpath that is "/home/container/garrysmod/" in this case. -- So we expect it to become "garrysmod.ver" print(filesystem.FullPathToRelativePath("/home/container/garrysmod/garrysmod.ver", "MOD_WRITE"))
garrysmod.ver