file.IsDir
From GMod Wiki
Revision as of 11:17, 15 October 2011 by TheFreeman193 (Talk | contribs)
Function | |
Syntax |
file.IsDir( String filename, [ Boolean usebasefolder ] ) Where is this used? |
Description: | |
Checks if a filename is a folder or a file | |
Returns: | Boolean |
Part of Library: | File |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=File.IsDir]File.IsDir [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | This example checks if "my_mod" is a folder, and if not creates it. |
---|---|
Used on | |
Code | if (not file.IsDir("my_mod")) then file.CreateDir("my_mod") end |
Output | N/A |
Additional Notes
- Relative to garrysmod/data.
- If usebasefolder is true then it starts relative to the GMod base folder (garrysmod/garrysmod).
- When creating a file, if the directory does not exist, it will create it, making this kind of useless in most situations.
- This function is extremely slow, taking up to .03 seconds to check if one file is a folder. See string.GetExtensionFromFilename.