# We need to find ltfatstop, but the path to it was already removed.
#

# Get the full path
dirname = fileparts (canonicalize_file_name (mfilename ("fullpath")));

pp = strsplit(dirname,filesep (), true);

# Just to be sure
if (! exist (fullfile (dirname, "inst"), "dir"))
  # We assume that ltfatstop is one directory up
  # Store the current path
  currPath = pwd;
  # We do not want the first empty string and the last filename
  tbdir = [[strcat(filesep(),{pp{2:end-1}})]{:}];
  # cd to directory with ltfatstop as functions cannot be called 
  # with run in Octave
  cd(tbdir);
  try
     feval('ltfatstop');
  catch
     disp('Call to ltfatstop failed. ');
     disp(lasterror.message);
     cd(currPath);
  end
  cd(currPath);
endif

# Do a cleanup since this is a script
clear dirname pp tbdir currPath

