Find answers, ask questions, and connect with our community of business solutions developers, and partners.
FileMaker File Path Format
FileMaker has long maintained its own file path format used internally to specify locations of external files or FileMaker data sources. The “standard” path formats used by the operating systems have changed over the years, but the FileMaker format has been the same since version 7.0.
In most cases, FileMaker paths can be easily recognized because they begin with one of these prefixes:
The file/image/movie prefixes can also have an OS extension: mac, win, or linux. Using one of these extensions is optional and is done to explicitly indicate that the path is only intended to be used with that particular OS. Here are some examples of OS-specific FileMaker paths:
With one exception, if a path begins with any of the prefixes described above, it is exclusively a FileMaker path. In other words, the operating system won’t know what to do with the path. The exception is paths that begin with file:// (two forwards slashes). Depending on what the rest of the path looks like, this kind of path could be either a FileMaker path or a standard file URL path. You can read more about the standard file URI scheme.
FileMaker Get Functions
FileMaker Get functions that return file paths also use the FileMaker path format, but most of them omit the scheme prefix.
Get ( DesktopPath ) = "/Macintosh HD/Users/mkos/Desktop/" // on mac = "/C:/Users/mkos/Desktop/" // on Windows
The product documentation states that script steps and FileMaker dialog boxes requiring a file path should use a properly formatted FileMaker path (although the paths constructed without a “file:” prefix seem to work just fine).
But if we want to adhere to the documentation, we can simply add the appropriate prefix – such as file: – to the path. For example:
"file:" & Get ( DesktopPath ) & "my.pdf"
Occasionally we have to use a path (that we have constructed within FileMaker) with an external system. One example of this is when a plugin is used to interact with the file system. In this case, we need to provide the plugin with a standard path, not a FileMaker path.
In the past, this involved writing code to convert paths; for example, like this:
"/Macintosh HD/Users/mkos/Desktop/" ⇛ "/Users/mkos/Desktop/" "/C:/Users/mkos/Desktop/" ⇛ "C:UsersmkosDesktop"
This extra step was a bit inconvenient, but in most cases, it didn’t pose problems. However occasionally, when the environments that had to be supported included different operating systems, remote volumes, and other complicating factors, the task of converting paths would become rather tricky.
Path Conversion Functions
FileMaker 19 introduces two new functions that accomplish this conversion for us:
ConvertToFileMakerPath ( standardPath ; format ) ConvertFromFileMakerPath ( filemakerPath ; format )
A few comments on the function parameters:
- standardPath is the operating system path that needs to be converted to a FileMaker path
- format can be one of the following: PosixPath, WinPath, or URLPath
- PosixPath is the path format used by Unix-like operating systems such as macOS and Linux
- WinPath is the path format used by Windows
- URLPath is the path format used by web-based systems
The three format options are constants and evaluate as follows:
- PosixPath = 1
- WinPath = 2
- URLPath = 3
Conveniently, the values for PosixPath and WinPath correspond to the value returned by Abs ( Get ( SystemPlatform ) ) when evaluated on a mac or a Windows computer.
Putting it all together, now we can easily convert a FileMaker path for use with an external system:
ConvertFromFileMakerPath ( Get ( DesktopPath ) & "my.pdf" ; Abs ( Get ( SystemPlatform ) ) ) = "/Users/kos/Desktop/my.pdf"
Similarly, we can go in the other direction as well:
ConvertToFileMakerPath ( "/Users/kos/Desktop/my.pdf" ; PosixPath ) = "file:/Macintosh HD/Users/kos/Desktop/my.pdf"
However, we need to be cautious when converting to FileMaker paths because standard paths are platform-specific. Even if we were to replace forward slashes with backslashes, the “/Users/kos/Desktop/my.pdf” path simply wouldn’t make sense in a Windows environment. As a result, if we try to convert this path using WinPath, the result will be “?”. So, as always, make sure to include error handling in your code by checking for “?”.
I have put together a very simple demo file to help you along as you learn and experiment with the new functions.
Next Steps in FileMaker 19
Path Conversion Functions is just one of many FileMaker 19 features our team has been exploring. If you have any questions on the platform’s new functionality, please feel free to contact our team.
We encourage you to visit their site and to inquire about their services. FMT is proud to deliver and promote FileMaker for Small Business Owners Worldwide since 1997. Our Forum The Original FileMaker Forum has 45,700+ members.