Check that file exists: Difference between revisions

Content added Content deleted
(Added Odin variant)
No edit summary
Line 1,385: Line 1,385:
'c:\docs' exists
'c:\docs' exists
</pre>
</pre>



=={{header|Frink}}==
=={{header|Frink}}==
This checks that the file exists and is a file, and that the directory exists, and is a directory. (Many of the samples on this page do not check that the files are actually a file or the directories are actually a directory.) It also tries to find various Unicode encodings of the "unusual" filename that may be encoded in different Unicode compositions (e.g. using "precomposed" or "decomposed" representations for some characters.
This checks that the file exists and is a file, and that the directory exists, and is a directory. (Many of the samples on this page do not check that the files are actually a file or the directories are actually a directory.) It also tries to find various Unicode encodings of the "unusual" filename that may be encoded in different Unicode compositions (e.g. using "precomposed" or "decomposed" representations for some characters.
Line 1,424: Line 1,427:
checkFile[normalizeUnicode[unusual, "NFD"]]
checkFile[normalizeUnicode[unusual, "NFD"]]
</syntaxhighlight>
</syntaxhighlight>


=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"

CFURLRef url
url = fn URLFileURLWithPath( @"~/Desktop/myTextFile.txt" )
if (fn FileManagerFileExistsAtURL( url ) )
NSLog( @"File already exists." )
else
NSLog( @"File does not exist at this location." )
end if

HandleEvents
</syntaxhighlight>


=={{header|Gambas}}==
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=fa06b7cc43166fb0ab48e878d86e3d1b Click this link to run this code]'''
'''[https://gambas-playground.proko.eu/?gist=fa06b7cc43166fb0ab48e878d86e3d1b Click this link to run this code]'''
Line 1,446: Line 1,467:
'`Abdu'l-Bahá.txt' does exist (zero length and unusual name)
'`Abdu'l-Bahá.txt' does exist (zero length and unusual name)
</pre>
</pre>



=={{header|GAP}}==
=={{header|GAP}}==
<syntaxhighlight lang="gap">IsExistingFile("input.txt");
<syntaxhighlight lang="gap">IsExistingFile("input.txt");