Garry's Mod Wiki

Revision Difference

util.FullPathToRelative_Menu#562982

<function name="FullPathToRelative_Menu" parent="util" type="libraryfunc"> <description> Converts the Full path of the given GMA file to the Relative Path. You can use <page>util.RelativePathToFull_Menu</page> to convert the Relative path back to the Full Path. Converts the full path of the given file to a relative path. You can use <page>util.RelativePathToFull_Menu</page> to convert the relative path back to the full path. </description> <realm>Menu</realm> <args> <arg name="gma" type="string">The **Full** path to the GMA file. **like: "[Steam folder]\common\garrysmod\garrysmod\addons\[Name].gma"**</arg>⤶ <arg name="gamePath" type="string" default="GAME">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</arg> <arg name="fullPath" type="string">The **full** path to a file.</arg>⤶ <arg name="fsPath" type="string" default="MOD">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</arg> </args> <rets> <ret name="relativepath" type="string">The relative path to the GMA file.</ret> <ret name="relativePath" type="string">The relative path to the given file.</ret> </rets> </function> <example> <description>Searches for a .gma file in your addons folder and converts the path to a full path.</description> <code> print( util.FullPathToRelative_Menu( "[Steam folder]\common\garrysmod\garrysmod\addons\[Name HERE].gma", "GAME" ) ) -- prints the relative path of the GMA file. </code> <output> ```lua addons\[Name].gma ``` </output> </example>