Mercurial > hg > ltpda
diff m-toolbox/classes/+utils/@helper/getHelpPath.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@helper/getHelpPath.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,37 @@ +% GETHELPPATH return the full path of the LTPDA toolbox help +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: GETHELPPATH return the full path of the LTPDA toolbox help. +% +% CALL: path = utils.helper.getHelpPath() +% +% EXCEPTION: Throws an error if this method doesn't find the LTPDA +% toolbox. +% +% VERSION: $Id: getHelpPath.m,v 1.2 2010/12/17 14:23:22 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function helpLocation = getHelpPath() + + root = getappdata(0, 'LTPDAROOT'); + if ~isempty(root) + helpLocation = fullfile(root, 'ltpda', 'help'); + return; + else + infoPath = which('info.xml'); + infoLocation = fileparts(infoPath); + + infoXML = xmlread('info.xml'); + tbNameNode = infoXML.getElementsByTagName('name'); + tbName = tbNameNode.item(0).getFirstChild.getData; + if strcmp(tbName, 'LTPDA') + helpLocationNodes = infoXML.getElementsByTagName('help_location'); + helpLocation = char(helpLocationNodes.item(0).getFirstChild.getTextContent); + else % Otherwise error out + error('Can not find info.xml file for My Toolbox'); + end + + helpLocation = fullfile(infoLocation, helpLocation); + end +end \ No newline at end of file