Garry's Mod Wiki

Revision Difference

file.Exists#518409

<function name="Exists" parent="file" type="libraryfunc"> <description>Returns a boolean of whether the file or directory exists or not.</description> <realm>Shared and Menu</realm> <args> <arg name="name" type="string">The file or directory&#x27;s name.</arg> <arg name="path" type="string">The path of where to look for the file.&#xA;&#xA;* &quot;GAME&quot; Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)&#xA;* &quot;LUA&quot; or &quot;lsv&quot; - All Lua folders (lua/) including gamesmodes and addons&#xA;* &quot;DATA&quot; Data folder (garrysmod/data)&#xA;* &quot;MOD&quot; Strictly the game folder (garrysmod/), ignores mounting.</arg>⤶ <arg name="name" type="string">The file or directory's name.</arg> <arg name="path" type="string">The path of where to look for the file.⤶ * "GAME" Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)⤶ * "LUA" or "lsv" - All Lua folders (lua/) including gamesmodes and addons⤶ * "DATA" Data folder (garrysmod/data)⤶ * "MOD" Strictly the game folder (garrysmod/), ignores mounting.</arg>⤶ </args> <rets> <ret name="" type="boolean">Returns true if the file exists and false if it is not.</ret> </rets> </function> <example> <description>Prints whether the `data` folder exists in the base directory.</description> <code>print( file.Exists("data", "GAME") )</code> <output>true</output> </example>