# HG changeset patch # User Markus Mützel # Date 1649776021 -7200 # Node ID f67d2ce5d6d42d94220d24c95698eef6815ac947 # Parent fc3b7160ba77b11a24db202d8fc86e8be6054cf6 pkg.m: Create directory before saving file (bug #62303). * scripts/pkg/pkg.m: Create directory before saving file when rebuilding package index. diff -r fc3b7160ba77 -r f67d2ce5d6d4 scripts/pkg/pkg.m --- a/scripts/pkg/pkg.m Mon Apr 11 18:34:05 2022 +0200 +++ b/scripts/pkg/pkg.m Tue Apr 12 17:07:01 2022 +0200 @@ -696,6 +696,10 @@ global_packages = standardize_paths (global_packages); endif global_packages = make_rel_paths (global_packages); + global_list_dir = fileparts (global_list); + if (! isempty (global_list_dir) && ! exist (global_list_dir, "dir")) + mkdir (global_list_dir); + endif save (global_list, "global_packages"); if (nargout) local_packages = global_packages; @@ -707,6 +711,10 @@ if (ispc) local_packages = standardize_paths (local_packages); endif + local_list_dir = fileparts (local_list); + if (! isempty (local_list_dir) && ! exist (local_list_dir, "dir")) + mkdir (local_list_dir); + endif save (local_list, "local_packages"); if (! nargout) clear ("local_packages");