-
Notifications
You must be signed in to change notification settings - Fork 24
How do I use relative paths for module and include XML configuration files?
Everybody knows the ../
(move up a directory) and ./
(same directory - relative to the current directory) syntax from HTML and *nix. Our relative path notation for Mach-II uses the same syntax. Please be aware that all relative paths are relative from the configuration file that defines the path to the other configuration file - not relative to your webroot or the root of your application. For example, if you have a configuration file named mach-ii.xml
in a directory named /appRoot/config/
and you want to include another config file that is located in the same directory as your mach-ii.xml
file, it would look like this:
<include file="./other-mach-ii.xml"/>
However, you cannot just use other-mach-ii.xml
as the path since ColdFusion's expandPath will try to expand from the webroot. You must start a relative path with the ./
or ../
syntax - which indicates to Mach-II that you are using a relative path.
Keeping in the same style, if you have your mach-ii.xml file in the /appRoot/config/
and you want to define a module that lives in /appRoot/modules/machblog/config/mach-ii.xml
, it would look like this:
<module name="blog" file="../modules/machblog/config/mach-ii.xml"/>
The example above uses the ../
syntax to move up a directory (from the /appRoot/config/
), into the /appRoot
directory and then in the directory path specified. Simple!