Easy cross platform and environment file paths
If you or dealing with file or directory manipulation on from CF then you will often need a way to get a file system path. You could just use it as follows:
This is of course very nasty as when you put this onto your live server you may not have farcry installed in c:\ - it may be somewhere completely different (particularly on shared hosting). Alternatively your live server may be a linux box in which case there is no "C:" drive at all.
To solve this and make you applications nice an portable you can use expandPath on a cf mapping. So assuming you have a cf mapping for /farcry to c:/farcry you would use the following:
This will now happily run on any machine that has the farcry mapping and will map to whatever location the mapping points to.
Cheers, Mark




There are no comments for this entry.
[Add Comment]