Home > src > geckomat > utilities > findGECKOroot.m

findGECKOroot

PURPOSE ^

findGECKOroot

SYNOPSIS ^

function [geckoPath, prevDir] = findGECKOroot()

DESCRIPTION ^

 findGECKOroot
   Finds the root of the GECKO directory, by searching for the path to
   GECKO.png. Can also record the current directory, in case a function will
   use the geckoPath to navigate to a precise folder, and it should return to
   the previous directory afterwards.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [geckoPath, prevDir] = findGECKOroot()
0002 % findGECKOroot
0003 %   Finds the root of the GECKO directory, by searching for the path to
0004 %   GECKO.png. Can also record the current directory, in case a function will
0005 %   use the geckoPath to navigate to a precise folder, and it should return to
0006 %   the previous directory afterwards.
0007 
0008 ST=dbstack('-completenames');
0009 prevDir = pwd();
0010 geckoPath = ST(strcmp({ST.name},'findGECKOroot')).file;
0011 rootFound = 0;
0012 while rootFound == 0
0013     isRoot = exist(fullfile(geckoPath,'GECKOInstaller.m'),'file');
0014     if isRoot == 2
0015         rootFound = 1;
0016     else
0017         ravenPathOld = geckoPath;
0018         geckoPath = fileparts(geckoPath);
0019         if strcmp(ravenPathOld,geckoPath)
0020             error('Cannot find the GECKO root directory. Make sure you have not removed the GECKOInstaller.m file from your GECKO installation.')
0021         end
0022     end
0023 end

Generated by m2html © 2005