## three problems:
## - the directory returned by 'mfilename' must not be added also
##   (endless loop)
## - 'genpath' of Octave 4.0 includes directories indiscriminately,
##    e.g. 'private' directories
## - PKG_ADD (and PKG_DEL?) is run during installation, too, from the
##   root directory of the package, where no such subdirectories
## exist.
if exist ("isfolder") == 0
  if (isdir (fullfile (fileparts (mfilename ("fullpath")), "base")))
    rmpath (fullfile (fileparts (mfilename ("fullpath")),
                    {"base", "distributions", "models", "tests"}){:});
  endif
else
  if (isfolder (fullfile (fileparts (mfilename ("fullpath")), "base")))
    rmpath (fullfile (fileparts (mfilename ("fullpath")),
                    {"base", "distributions", "models", "tests"}){:});
  endif
endif
