I ran into an issue recently where my production server's code used a different drive letter than my development environment. A small handful of applications relied on that drive letter and would break if the drive letter wasn't changed before deployment. In these specific scenarios, I couldn't call expandPath() or getTemplatePath() directly because the application wasn't in the root of the website.
My solution to this issue was to put the code below in my application.cfm / application.cfc file which sets an application variable called "driveLetter" to the applications current drive letter; then I call the application variable instead of the static drive letter that could change.
Get Drive letter
If you want to get the drive letter once, you could use do something like below.
<cfset variables.driveLetter = listGetAt(expandPath('\'),1,'\')&'\' />
Get drive letter, then set application variable.
Below is the exact code I used in my application.cfm file to set the application variable initially, that way I don't have to run the script every time.
<cfif !isDefined('application.driveLetter')> <cflock scope='application' timeout='5'> <cfset application.driveLetter = listGetAt(expandPath('\'),1,'\')&'\'/> </cflock> </cfif>