> I would say it is more an issue with ExpandPath().
> 
> Remember how it actually works?
> 
> If you are in C:\apache\htdocs then that is where it will be expanded.
> if you are in 
> C:\apache\htdocs\galleon\ontap\_components\_includes\galleon\udf.cfm
> then that is what will be expanded.
> 
> If you have a mapping for /inc, then why the hell are you doing an 
> ExpandPath()?

Well you'r information about ExpandPath is almost correct. 

ExpandPath uses the directory containing the base template (not the
current template, which would be far more useful but isn't provided
anywhere in the server). 

What this means is that if you go to http://localhost/index.cfm and
inside index.cfm you include say /some/sub/directory/thing.cfm and
output ExpandPath("else.cfm") inside of thing.cfm, you'll get
C:\apache\htdocs\else.cfm instead of
C:\apache\htdocs\some\sub\directory\else.cfm 

However... that's not the whole story. 

Mappings always begin with a forward slash, i.e. the mapping is "/inc"
not "inc". If your path argument to the ExpandPath() function begins
with a forward slash then, the server will attempt to match the path to
any available mappings and expand from the mapping instead of the base
template. So if you have a mapping of "/inc" to C:\foo and the mapping
is working, then when you ExpandPath("/inc/something.zip") you'll get
C:\foo\something.zip instead of C:\apache\htdocs\something.zip ... 

That's why in my first post I mentioned that I knew the mapping was
working because the first ExpandPath call in the Application.cfc was
expanding the mapping instead of the base template directory that was
being expanded the 2nd time. So the same ExpandPath() call either before
or after the cfapplication tag was producing 2 different paths. 

In htdocs\galleon\ontap\application.cfc I was getting: 
- C:\apache\htdocs\galleon\ontap\_components\_includes\galleon\udf.cfm 
(what I wanted) 

and in htdocs\galleon\ontap\index.cfm I was getting: 
- C:\apache\htdocs\galleon\ontap\inc\galleon\udf.cfm 
(not what I wanted)

So... long and short the answer to "why the hell are you using
expandpath()?" is because it works with mappings. I was actually only
using it to test the mapping, I wasn't even using it because I needed
the full path, I just needed to test the mapping. 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 617.365.5732

http://onTap.riaforge.org/blog



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305869
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to