Show
Ignore:
Timestamp:
12/20/06 13:12:58 (2 years ago)
Author:
scorfield
Message:

Fixes #135 by adding a check in strict mode that (a) only one of *.xml / *.xml.cfm exists
(for fusebox and circuit files) and (b) the file extensions are consistent (i.e., you can't
have fusebox.xml and then circuit.xml.cfm). The last may prove controversial.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • framework/trunk/fuseboxApplication.cfc

    r279 r280  
    9393                                        hint="I am the myFusebox data structure." /> 
    9494                 
    95                 <!--- fix ticket 138 ---> 
     95                <!--- fix ticket 135 ---> 
    9696                <cfset var myVersion = "5.0.1.#REReplace('$LastChangedRevision$','[^0-9]','','all')#" /> 
    9797 
     
    9999                <cfset variables.fuseboxLexicon = variables.factory.getBuiltinLexicon() /> 
    100100                <cfset variables.customAttributes = structNew() /> 
     101                 
     102                <cfset variables.fuseboxFileExtension = "" /> 
    101103 
    102104                <cfset variables.fuseboxVersion = myVersion /> 
     
    153155                 
    154156                <cfset var fbFile = "fusebox.xml.cfm" /> 
     157                <cfset var fbFileAlt = "fusebox.xml" /> 
    155158                <cfset var fbXML = "" /> 
    156159                <cfset var fbCode = "" /> 
     
    161164                <cfset var jFuseboxFile = "" /> 
    162165                <cfset var dtLastModified = "" /> 
     166                 
     167                <!--- 
     168                        since we need to check the file, regardless of whether we load it, 
     169                        we might as well do the test up front and perform the strict check 
     170                        that just one version exists (ticket 135) 
     171                ---> 
     172                <cfif fileExists(this.approotdirectory & fbFile)> 
     173                        <cfif this.strictMode and fileExists(this.approotdirectory & fbFileAlt)> 
     174                                <cfthrow type="fusebox.multipleFuseboxXML"  
     175                                                message="Both 'fusebox.xml' and 'fusebox.xml.cfm' exist"  
     176                                                detail="'fusebox.xml.cfm' will be used but 'fusebox.xml' also exists in '#this.approotdirectory#." /> 
     177                        </cfif> 
     178                <cfelse> 
     179                        <cfset fbFile = fbFileAlt /> 
     180                </cfif> 
    163181 
    164182                <cfif structKeyExists(this,"timestamp")> 
    165                         <cfif not fileExists(this.approotdirectory & fbFile)> 
    166                                 <cfset fbFile = "fusebox.xml" /> 
    167                         </cfif> 
    168183                        <!--- Java timestamp solution provided by Daniel Schmid ---> 
    169184                        <cfset myFuseboxFilePath = this.approotdirectory & fbFile /> 
     
    178193                        </cfif> 
    179194                        <!--- attempt to load fusebox.xml(.cfm): ---> 
    180                         <cfif not fileExists(this.approotdirectory & fbFile)> 
    181                                 <cfset fbFile = "fusebox.xml" /> 
    182                         </cfif> 
    183195                        <cftry> 
    184196                                 
     
    186198                                                variable="fbXML" 
    187199                                                charset="#this.characterEncoding#" /> 
     200                                                 
     201                                <cfset variables.fuseboxFileExtension = listLast(fbFile,".") /> 
    188202                                 
    189203                                <cfcatch type="any"> 
     
    605619        </cffunction> 
    606620         
     621        <cffunction name="getFuseboxFileExtension" returntype="string" access="public" output="false"  
     622                                hint="I return the fusebox.xml file extension: either xml or cfm."> 
     623                                         
     624                <cfreturn variables.fuseboxFileExtension /> 
     625                 
     626        </cffunction> 
     627         
    607628        <cffunction name="deleteParsedFiles" returntype="void" access="private" output="false"  
    608629                                hint="I delete all the script files in the parsed/ directory.">