Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: Is it just me or are this.mappings acting funny?

$
0
0

Aegis Kleais wrote:

 

<cfdump var="#fileExists( expandPath( '/path/to/models/utils/Config.cfc' ) )#" /> <!--- This dumps YES. --->

 

<cfset this.mappings[ '/model' ] = expandPath( '/path/to/models/' ) /> <!--- Same as c:\web-root\path\to\models\ --->

 

<cfdump var="#fileExists( expandPath( '/model/utils/Config.cfc' ) )#" /> <!--- This dumps NO. I've yet to figure out why. --->

 

CF documentation states that fileExists() should work with in-memory addresses, but I don't know if that means 'mappings'.

I think the second fileExists() call fails because ColdFusion interpretes the argument in expandPath as literally a relative path. Hence, assuming the current directory is c:\web-root,

 

expandPath( '/path/to/models/utils/Config.cfc' ) has the value c:\web-root\path\to\models\utils\Config.cfc

 

and

 

expandPath( '/model/utils/Config.cfc' ) has the value c:\web-root\model\utils\Config.cfc


Viewing all articles
Browse latest Browse all 21760

Trending Articles