From e5f0125a4cc95a13f570c70601d30934051bc9e0 Mon Sep 17 00:00:00 2001 From: mobeets Date: Sun, 29 Jul 2018 21:57:25 -0400 Subject: [PATCH] wrong order of src dst when using copyfile, fixes #53 --- mpm.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mpm.m b/mpm.m index 3cd8fe4..8b98fc7 100644 --- a/mpm.m +++ b/mpm.m @@ -380,7 +380,7 @@ function listPackages(opts) isOk = false; return; end mkdir(pkg.installdir); - isOk = copyfile(pkg.installdir, pkg.url); + isOk = copyfile(pkg.url, pkg.installdir); else % no copy; just track the provided path % make sure we have absolute path if ~isempty(strfind(pkg.url, pwd)) @@ -432,7 +432,11 @@ function listPackages(opts) try zipfnm = websave(zipfnm, pkg.url); catch ME + % handle 404 from File Exchange for getting updated download url ps = strsplit(ME.message, 'for URL, '); + if numel(ps) < 2 + isOk = false; return; + end ps = strsplit(ps{2}, 'github_repo.zip'); pkg.url = ps{1}(2:end); zipfnm = websave(zipfnm, pkg.url);