Published:
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.
Problems with Fusebox 4+
At this stage you should be able to deploy your compiled code and enjoy the benefits of precompiled cfml...that is unless you happen to use the fusebox framework (specifically the xml based versions 4 and above).
The problem is that fusebox4+ uses xml config files. In of itself this is not a problem except that it is necessary to hide these files from being directly visible. Fusebox accomplishes this by appending the cfm extension to the xml config files. Thus a circuit.xml file is actually named circuit.xml.cfm . This results in the cfcompiler trying to translate the xml files into java bytecode. While the compiler succeeds Fusebox is unable to read and utilise the resulting gibberish.
The Batch File Solution
Fortunately the solution is a little piece of batch file magic. First create a txt file and paste the following code.
@echo off
echo Please input source folder path (DO NOT QUOTE PATH)
echo Wrong: "C:\DIR\FILES\"
echo Correct: C:\DIR\FILES
set /p source=Source Directory:
echo Please input destination folder path
set /p dest=Destination Directory:
:: /s tells xcopy to also do subfolders
:: /y turns off overwrite prompt
xcopy /s /y "%source%\*.appinit.cfm" %dest%
xcopy /s /y "%source%\*.init.cfm" %dest%
xcopy /s /y "%source%\*.xml.cfm" %dest%
echo Files successfully copied!
pause>nul
exit
Now convert the txt file to a batch file by changing its extension from.txt to .bat. Name this file as "fuseboxCompileFix.bat". After creating our java bytecode we can run fuseboxCompileFIx from the command prompt to go back to our source code directory and recopy the xml config files to overwrite the bytecode gibberish in the compiled directory.
All this code does is ask for the source code directory, the destination (ie compiled code) directory and recursively overwrite any of the three types of config file with the source code original.
Reader Comments