How to get resource filepath

Exact resource file path according to the filename and directory can be achieved by using the following function.