Below is a diff proposal for pkg.m, which makes it a little bit more
system-independent. Besides this, I have a problem when trying to
uninstall a package, which has been loaded, due to the fact that you
can't remove a DLL (oct-files are DLL's) if a process has mapped it
into memory.
This can happen, even if you didn't actually call any function in the
package, due to "autoload" statements that use "which", like
autoload ("glog", which ("gf"));
Is it possible to automatically unload all oct-files that are part of a
package?
function prepare_installation(desc, packdir) ## Is there a pre_install to call? - if (exist([packdir
"pre_install.m"], "file")) + if (exist(fullfile(packdir, "pre_install.m"), "file")) wd = pwd(); try cd(packdir); @@ -618,8 +618,9 @@ endif
## If the directory "inst" doesn't exist, we create it - if (!exist([packdir "inst"], "dir")) - [status, msg] = mkdir([packdir "inst"]); + inst_dir = fullfile(packdir, "inst"); + if (!exist(inst_dir, "dir")) + [status, msg] = mkdir(inst_dir); if (status != 1)
rm_rf(desc.dir); error("The 'inst' directory did not exist and could not be created: %s", msg);