Changeset 1736

Show
Ignore:
Timestamp:
08/28/08 17:07:21 (4 months ago)
Author:
lmajano
Message:

locatePath() additions and fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/CodeDepot/interceptors/com/ortussolutions/deployment/Deploy.cfc

    r1729 r1736  
    2020 
    2121- tagFile : config/_deploy.tag [required] 
    22 - cleanupCommandObject : The class path of the cleanup command object to use [optional]. Must implement 
    23   an init(controller) and an execute() method. 
     22- deployCommandObject : The class path of the deploy command object to use [optional]. Must implement 
     23  an init(controller) and an execute() method.  This command object will be executed before the framework 
     24  reinit bit is set. 
    2425         
    2526-----------------------------------------------------------------------> 
  • coldbox/trunk/system/config/settings.xml

    r1699 r1736  
    77        <Setting name="AuthorWebsite" value="http://www.coldboxframework.com"/> 
    88        <Setting name="Suffix" value="FAITH"/> 
    9         <Setting name="Version" value="2.6.1"/> 
     9        <Setting name="Version" value="2.6.2"/> 
    1010        <Setting name="Description" value="This is the ColdBox ColdFusion Framework for web applications."/> 
    1111        <Setting name="ModifyLogLocation" value="readme.txt"/> 
  • coldbox/trunk/system/frameworkSupertype.cfc

    r1617 r1736  
    235235 
    236236<!------------------------------------------- UTILITY METHODS -------------------------------------------> 
     237         
     238        <!--- locateFilePath ---> 
     239        <cffunction name="locateFilePath" output="false" access="private" returntype="string" hint="Locate the real path location of a file in a coldbox application. 3 checks: 1) inside of coldbox app, 2) expand the path, 3) Absolute location. If path not found, it returns an empty path"> 
     240                <cfargument name="pathToCheck" type="string" required="true" hint="The path to check"/> 
     241                <cfscript> 
     242                        var foundPath = ""; 
     243                        var appRoot = controller.getAppRootPath(); 
     244                         
     245                        //Check 1: Inside of App Root 
     246                        if ( fileExists(appRoot & arguments.pathToCheck) ){ 
     247                                foundPath = appRoot & arguments.pathToCheck; 
     248                        } 
     249                        //Check 2: Expand the Path 
     250                        else if( fileExists( ExpandPath(arguments.pathToCheck) ) ){ 
     251                                foundPath = ExpandPath( arguments.pathToCheck ); 
     252                        } 
     253                        //Check 3: Absolute Path 
     254                        else if( fileExists( arguments.pathToCheck ) ){ 
     255                                foundPath = arguments.pathToCheck; 
     256                        } 
     257                         
     258                        //Return  
     259                        return foundPath;                        
     260                </cfscript> 
     261        </cffunction> 
    237262         
    238263        <!--- cfhtml head facade ---> 
     
    289314        </cffunction> 
    290315         
     316        <!--- Rethrow Facade ---> 
     317        <cffunction name="rethrowit" access="public" returntype="void" hint="Rethrow facade" output="false" > 
     318                <cfargument name="throwObject" required="true" type="any" hint="The cfcatch object"> 
     319                <cfthrow object="#arguments.throwObject#"> 
     320        </cffunction> 
     321         
    291322        <!--- Abort Facade ---> 
    292323        <cffunction name="abort" access="private" hint="Facade for cfabort" returntype="void" output="false"> 
  • coldbox/trunk/system/interceptors/environmentControl.cfc

    r1533 r1736  
    3030                <cfscript> 
    3131                        var configFile = ""; 
    32                         var appRoot = getController().getAppRootPath(); 
    33                  
    34                         /* Clean app root */ 
    35                         if( right(appRoot,1) neq getSetting("OSFileSeparator",true) ){ 
    36                                 appRoot = appRoot & getSetting("OSFileSeparator",true); 
    37                         } 
    3832                         
    39                         //Verify that the configFile propety is set 
     33                        /* Verify that the configFile propety is set */ 
    4034                        if( not propertyExists('configFile') ){ 
    4135                                throw("Config File property does not exist. Please declare it.",'','interceptors.environmentControl.configFilePropertyNotDefined'); 
    4236                        } 
    43                         //Test if the file exists AS RELATIVE 
    44                         if ( fileExists(appRoot & getProperty('configFile')) ){ 
    45                                 configFile = appRoot & getProperty('configFile'); 
    46                         } 
    47                         /* Test as expanded relative */ 
    48                         else if( fileExists( ExpandPath(getProperty('configFile')) ) ){ 
    49                                 configFile = ExpandPath( getProperty('configFile') ); 
    50                         } 
    51                         /* Test as absolute */ 
    52                         else if( fileExists( getProperty('configFile') ) ){ 
    53                                 configFile = getProperty('configFile'); 
    54                         } 
    55                         else{ 
     37                        /* Try to locate the path */ 
     38                        configFile = locateFilePath(getProperty('configFile')); 
     39                        /* Validate it */ 
     40                        if( len(configFile) eq 0 ){ 
    5641                                throw('Config File could not be located: #getProperty('configFile')#. Please check again.','','interceptors.environmentControl.configFileNotFound'); 
    5742                        } 
  • coldbox/trunk/system/interceptors/security.cfc

    r1606 r1736  
    287287                        var x=1; 
    288288                        var node = ""; 
    289                         var appRoot = getController().getAppRootPath(); 
    290                  
    291                         /* Clean app root */ 
    292                         if( right(appRoot,1) neq getSetting("OSFileSeparator",true) ){ 
    293                                 appRoot = appRoot & getSetting("OSFileSeparator",true); 
    294                         } 
    295                          
    296                         //Test if the file exists 
    297                         if ( fileExists(appRoot & getProperty('rulesFile')) ){ 
    298                                 rulesFile = appRoot & getProperty('rulesFile'); 
    299                         } 
    300                         /* Expanded Relative */ 
    301                         else if( fileExists( ExpandPath(getProperty('rulesFile')) ) ){ 
    302                                 rulesFile = ExpandPath( getProperty('rulesFile') ); 
    303                         } 
    304                         /* Absolute Path */ 
    305                         else if( fileExists( getProperty('rulesFile') ) ){ 
    306                                 rulesFile = getProperty('rulesFile'); 
    307                         } 
    308                         else{ 
     289                         
     290                        /* Try to locate the file path */ 
     291                        rulesFile = locateFilePath(getProperty('rulesFile')); 
     292                        /* Validate Location */ 
     293                        if( len(rulesFile) eq 0 ){ 
    309294                                throw('Security Rules File could not be located: #getProperty('rulesFile')#. Please check again.','','interceptors.security.rulesFileNotFound'); 
    310295                        } 
     296                         
    311297                        /* Set the correct expanded path now */ 
    312298                        setProperty('rulesFile',rulesFile); 
  • coldbox/trunk/system/plugins/ioc.cfc

    r1735 r1736  
    222222        <cffunction name="validateDefinitionFile" access="private" output="false" returntype="void" hint="Validate the IoC Definition File. Called internally to verify the file location and get the correct path to it."> 
    223223                <cfscript> 
    224                         var appRoot = getController().getAppRootPath(); 
    225                          
    226                         /* Clean app root */ 
    227                         if( right(appRoot,1) neq getSetting("OSFileSeparator",true) ){ 
    228                                 appRoot = appRoot & getSetting("OSFileSeparator",true); 
    229                         }                
    230                          
    231                         /* Relative App Path Check */ 
    232                         if( fileExists(appRoot & getIOCDefinitionFile()) ){ 
    233                                 setExpandedIOCDefinitionFile( appRoot & getIOCDefinitionFile() ); 
    234                         } 
    235                         /* Expand Path Check */ 
    236                         else if( fileExists( expandPath(getIOCDefinitionFile()) ) ){ 
    237                                 setExpandedIOCDefinitionFile( ExpandPath(getIOCDefinitionFile()) ); 
    238                         } 
    239                         /* Absolute Path Check */ 
    240                         else if( fileExists(getIOCDefinitionFile()) ){ 
    241                                 setExpandedIOCDefinitionFile( getIOCDefinitionFile() ); 
    242                         } 
    243                         else{ 
     224                        var foundFilePath = ""; 
     225                         
     226                        /* Try to locate the path */ 
     227                        foundFilePath = locateFilePath(getIOCDefinitionFile()); 
     228                        /* Validate it */ 
     229                        if( len(foundFilePath) eq 0 ){ 
    244230                                throw("The definition file: #getIOCDefinitionFile()# does not exist. Please check your path","","ColdBox.plugins.ioc.InvalidDefitinionFile"); 
    245231                        } 
     232                        /* Save the found location path */ 
     233                        setExpandedIOCDefinitionFile( foundFilePath ); 
    246234                </cfscript> 
    247235        </cffunction> 
  • coldbox/trunk/system/plugins/logger.cfc

    r1602 r1736  
    367367        <!--- Create the default log directory ---> 
    368368        <cffunction name="createDefaultLogDirectory" access="private" hint="Creates the default log directory." output="false" returntype="void"> 
    369                 <cfset var DefaultLogDirectory = getSetting("ApplicationPath",1) & getSetting("OSFileSeparator",1) & getSetting("DefaultLogDirectory",1)> 
     369                <cfset var DefaultLogDirectory = getSetting("ApplicationPath",1) & getSetting("DefaultLogDirectory",1)> 
    370370                <!--- Check if the directory already exists ---> 
    371371                <cfif not directoryExists(DefaultLogDirectory)> 
  • coldbox/trunk/system/plugins/resourceBundle.cfc

    r1654 r1736  
    115115                var thisMSG = ""; 
    116116                var keys = ""; 
    117                 var appRoot = getController().getAppRootPath(); 
    118117                var rbFilePath = arguments.rbFile & "_#arguments.rbLocale#.properties"; 
    119118                var rbFullPath = rbFilePath; 
    120                          
    121                 /* Clean app root */ 
    122                 if( right(appRoot,1) neq getSetting("OSFileSeparator",true) ){ 
    123                         appRoot = appRoot & getSetting("OSFileSeparator",true); 
     119                 
     120                /* Try to locate the path */ 
     121                rbFullPath = locateFilePath(rbFilePath); 
     122                /* Validate Location */ 
     123                if( len(rbFullPath) eq 0 ){ 
     124                        throw("The resource bundle file: #rbFilePath# does not exist. Please check your path","","ColdBox.plugins.resourceBundle.InvalidBundlePath"); 
    124125                } 
    125                 /* Absolute Path Check */ 
    126                 if( not fileExists(rbFullPath) ){ 
    127                         /* Relative App Path Check */ 
    128                         if( fileExists(appRoot & rbFilePath) ){ 
    129                                 rbFullPath = appRoot & rbFilePath; 
    130                         } 
    131                         /* Expand Path Check */ 
    132                         else if( fileExists( expandPath(rbFilePath) ) ){ 
    133                                 rbFullPath = ExpandPath(rbFilePath); 
    134                         } 
    135                         else{ 
    136                                 throw("The resource bundle file: #rbFullPath# does not exist. Please check your path","","ColdBox.plugins.resourceBundle.InvalidBundlePath"); 
    137                         } 
    138                 }                
    139126                 
    140127                //Load Instance 

Copyright 2006 ColdBox Framework by Luis Majano