ACF Library

DirectoryExists

Back to List

Description: Check if a folder at a given path exists.

FileMaker Prototype:

Set Variable [$res; ACFU_DirectoryExists( string_DirectoryPath)]

Category: BOOTSTRAP

NOTE: The bootstrap library comes preloaded in the plugin. Read more

Function source:

function DirectoryExists ( string DirectoryPath ) 
   FunctionID 204; 
   if ( isMac ) then
      DirectoryPath = substitute ( DirectoryPath, ":", "/");
      if ( ! directory_exists ( DirectoryPath ) ) then
         if ( left ( DirectoryPath, 1 ) != "/") then
            DirectoryPath = "/Volumes/" + DirectoryPath; 
         else
            return false; 
         end if
      else 
         return true; 
      end if
   else
      DirectoryPath = substitute ( DirectoryPath, "/", "\\");
   end if
   return directory_exists ( DirectoryPath ) ; 
end

DirectoryExists checks if a directory exists at the specified path, with platform-specific adjustments for macOS and Windows.

  • macOS: Replaces colon (:) separators with forward slashes (/). If the directory 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.

Back to List