file_exists
| Definition: | bool res = file_exists(string name) |
| Description: |
Check to see if a file or directory exists
name: filename to check (absolute or relative to the current directory) Returns: true (1) if it exists, false (0) if it does not. |
| pwa/p2js: | Not supported. |
| Comments: |
If you want to know that something is actually a file and not a directory, just use
get_file_type(filename)==FILETYPE_FILE.
Both forwardslash ('/') and backslash ('\\') are handled for all platforms. |
| Example: |
if file_exists(`C:\Program Files (x86)\Phix\p.exw`)
and file_exists(`C:\Program Files (x86)\Phix\`)
and file_exists(`C:\Program Files (x86)\Phix`) then
puts(1,"all three are true!\n")
end if
if file_exists("backup") then
-- (get_file_type("backup")==FILETYPE_DIRECTORY may be better)
puts(1,"there is a backup folder in the current directory")
end if
|
| Implementation: | See builtins\pfile.e (an autoinclude) for details of the actual implementation. |