function ncsetup

% nctree -- Setup the NetCDF Toolbox tree.
%  nctree uses newfolder() to create the directory
%   tree required by the NetCDF Toolbox for Matlab-5.
 
% Copyright (C) 1997 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 25-Mar-1997 17:24:25.
% Version of 28-Mar-1997 09:06:39.

theToolbox = {'netcdf'};

theClasses = {'netcdf'; ...
              'ncdim'; 'ncvar'; 'ncatt'; ...
              'ncrec'; 'ncslice'; 'ncitem'};
              
theTypes = {'nctype'};
theUtilities = {'ncutility'};

for i = 1:length(theClasses)
   theClassPrefix = '@';
   if any(findstr(computer, 'VMS'))
      theClassPrefix = '#';
   end
   theClasses{i} = [theClassPrefix theClasses{i}];
end

theFolders = [theToolbox; theClasses; theTypes; theUtilities]
for i = 2:length(theFolders)
   theFolders{i} = fullfile(theToolbox{1}, theFolders{i});
end

theFolders

disp(' ')
disp(' ## If any failure occurs on a "cd" operation, create the')
disp(' ##  following directory tree manually, then try again.')
disp(' ##  Ignore other error messages.')
disp(' ')

for i = 1:length(theFolders)
   disp([' ##       ' fullfile(pwd, theFolders{i})])
end

disp(' ')
disp(' ## The following directories will need to be in your')
disp(' ##  Matlab path after the installation has finished.')
disp(' ##  The "ncstartup" function in the "netcdf" folder')
disp(' ##  is available for this purpose.')
disp(' ')

for i = 1:length(theFolders)
   if ~any(theFolders{i} == theClassPrefix)
      disp([' ##       ' fullfile(pwd, theFolders{i})])
   end
end

disp(' ')
for i = 1:length(theFolders)
   newfolder(theFolders{i})
   if ~any(theFolders{i} == theClassPrefix)
      path(fullfile(pwd, theFolders{i}), path)
   end
end

p = pwd;
for i = 1:length(theFolders)
   eval(['cd ' fullfile(p, theFolders{i})])
   if (0)
      delete *.m
      delete *.p
   end
end
eval(['cd ' p]);

disp(' ')
disp(' ## Directory tree okay.')
