FileExists
Back to ListDescription: Check if a file at a given path exists.
FileMaker Prototype:
Set Variable [$res; ACFU_FileExists( string_FilePath)]
Category: BOOTSTRAP
NOTE: The bootstrap library comes preloaded in the plugin. Read more
Function source:
function FileExists ( string FilePath )
FunctionID 229;
if ( isMac ) then
FilePath = substitute ( FilePath, ":", "/");
if ( ! file_exists ( FilePath ) ) then
if ( left ( FilePath, 1 ) != "/") then
FilePath = "/Volumes/" + FilePath;
else
return false;
end if
else
return true;
end if
else
FilePath = substitute ( FilePath, "/", "\\");
end if
return file_exists ( FilePath ) ;
end
FileExists Similar to the DirectoryExists function, but addresses a file instead. Checks if a file exists at the specified path, with platform-specific adjustments for macOS and Windows.
Example
Set Variable [$res; ACFU_FileExists( string_FilePath)]
- macOS: Replaces colon (:) separators with forward slashes (/). If the file does not exist, the function checks if the path starts with /. If not, it prepends /Volumes/ to the path and checks again.
- Windows: Replaces forward slashes (/) with backslashes (\), the standard directory separator in Windows paths.
Note: On Windows, both forward slashes and backslashes are supported as directory separators by other file-related functions in the plugin.
