[bac297]: PKG_DEL Maximize Restore History

Download this file

PKG_DEL    36 lines (32 with data), 1.4 kB

dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs",...
## Get full path, with luck we can retireve the package name from here
dirname = fileparts (canonicalize_file_name (mfilename ("fullpath")));
pp = strsplit (dirname,filesep (), true);
arch = cstrcat (octave_config_info ("canonical_host_type"),
                              "-", octave_config_info ("api_version"));
if strcmp (arch , pp{end})
  # If we are in Architecture dependent folder, we assume the package is the level above
  pkg_name = pp{end-1};

%% Get the correct path
% Search installed packages
[local_packages, global_packages] = pkg("list");
installed_pkgs_lst = {local_packages{:}, global_packages{:}};
pkg_data = installed_pkgs_lst (cellfun(@(x) ismember (x.name, {"geometry"}), ...
                                             installed_pkgs_lst, "unif", true));
if isempty(pkg_data)
  % The package is not installed yet
  [pkg_folder dep_folder] = pkg ("prefix");
  pkg_folder = fullfile (pkg_folder,pkg_name);
  pkg_folder = pkg_data{1}.dir;

if (exist (fullfile (dirname, "inst"), "dir"))
  warning("geometry:Devel","Removing path for testing.");
  for ii=1:length(dirlist)
    rmpath ([ dirname "/inst/" dirlist{ii}])

clear dirlist dirname pp arch pkg_folder dep_folder pkg_name