function  pathstr = work_pathstr

%WORK_PATHSTR -- The path string to the root of the WORK directory-tree
%
%  pathstr = work_pathstr
%
%  Example:  work_pathstr --> 'C:\work'
%
%  See also CD, FILEPARTS, FULLFILE, PWD, PLM_PATHSTR.

%  Original coding by Alexander Petrov, http://alexpetrov.com
%  $Revision: 1.1 $  $Date: 2006/06/08 16:14 $

pathstr = fileparts(which('work_pathstr')) ;  % 'C:\work\utils\general'
idx = find(pathstr==filesep) ;                %    ^    ^     ^
if (filesep~=':')
	cutoff = idx(end-1) ;                     %         ^     \
else  % FILEPARTS on Mac OS 9.2 puts an extra trailing ':'
	cutoff = idx(end-2) ;                     %         ^     :       :
end
pathstr(cutoff:end) = [] ;                    % 'C:\work'

%--- Return PATHSTR
%%%%% End of file WORK_PATHSTR.M
