function pth = get_curr_m_file_path (m_file_name)
% GET_CURR_M_FILE_PATH returns the path for a mfile.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: GET_CURR_M_FILE_PATH returns the path for a mfile.
%
% CALL:        path = get_curr_m_file_path(mfilename)
%              path = get_curr_m_file_path('explore_ao')
%
% VERSION:     $Id: get_curr_m_file_path.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $
%
% HISTORY: 25-06-07  Diepholz
%             Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

pth = '';
eval (sprintf('pth = which(''%s'');',m_file_name))
index = find(pth==filesep, 1, 'last');
pth   = pth(1:index);