问题
To get the current *.cfm
file I use:
GetFileFromPath(GetCurrentTemplatePath())
Is there a simple way to get the parent of the current file?
I.e. if the current file is ...\MyApp\Users\addUser.cfm
I want to return Users
.
Edit: the reason I want to do this is to check for access permission. Depending on path different policies will be enforced.
Edit: The linked question doesn't provide the correct answer.
回答1:
GetFileFromPath(GetFileInfo(GetCurrentTemplatePath()).parent)
This will return exactly what I need. Using the example from the question: just Users
withouth the full path.
来源:https://stackoverflow.com/questions/31539348/how-can-i-get-the-parent-of-the-current-file