Strange expandPath bug in ColdFusion 8

Posted by Mark Drew on code on January 23, 2009

Tagged under coldfusion

I found something that I am not sure if it is a bug or a "feature" whilst developing some functionality in our CMS. Essentially imagine you have the following directory layout:

  • index.cfm
  • level1/
    • level2/
      • index.cfm

In the root index.cfm I want to expand the path to level2, that is, get the full folder path of “path2”, you would do something like:
</code>

Which (in my case) returns: /Library/WebServer/Documents/scratch/level1/level2

BUT if you add the forward slash to the path:
</code>
You get: /Library/WebServer/Documents/scratch/level1/level2/index.cfm/ ?!
Where did "index.cfm/" come from? I can understand how that might be useful in 0.1% of cases but not when you are simply trying to find the path to the folder. If you remove the index.cfm from the folder it all works fine. </p>

Shome mishtake, shurely?




comments powered by Disqus