FileOps.$doesfileexist()

Function groupExecute on clientPlatform(s)
FileOpsNOAll

Syntax

FileOps.$doesfileexist(cPath)

Description

Returns true if the file or folder named cPath exists. Otherwise, it returns false.

Example

Switch
 
platform(
()

  
Case
 
'X'
 
## for macOS

    
Do
 
FileOps
.
$doesfileexist
(
'/Users/omnis/welcome/tutorial/mylib.lbs'
)
 
Returns 
lStatus

  
Case
 
'U'
 
## for Linux

    
Do
 
FileOps
.
$doesfileexist
(
'/omnis/welcome/tutorial/mylib.lbs'
)
 
Returns 
lStatus

  
Default
 
## for Windows

    
Do
 
FileOps
.
$doesfileexist
(
'c:\omnis\welcome\tutorial\mylibs.lbs'
)
 
Returns 
lStatus

End Switch
# lStatus is true if 'mylib.lbs' exists in the Omnis tutorial

 
 
 
# For macOS, to convert legacy HFS file paths to POSIX for use with functions such as $doesfileexist use:

Do
 
FileOps
.
$converthfspathtoposixpath
(
'HD:Users:omnis:welcome:tutorial:mylib.lbs'
,
lPosixPath
)

 
# For macOS, to convert a POSIX path back to HFS use:

Do
 
FileOps
.
$convertposixpathtohfspath
(
'/Users/omnis/welcome/tutorial/mylib.lbs'
,
lHfsPath
)