Garry's Mod Wiki

file.Exists

boolean file.Exists( string name, string path )

Description

Returns a boolean of whether the file or directory exists or not.

Arguments

1 string name
The file or directory's name.
2 string path
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.

Returns

1 boolean
Returns true if the file exists and false if it is not.

Example

Prints whether the data folder exists in the base directory.

print( file.Exists("data", "GAME") )
Output: true

Page Links


Special Pages


Wikis

?

Render Time: 35ms

Session 0
DB GetPage 3
Generate Html 9
SaveChanges 9
Render Body 0
Render Sidebar 11