changeset 6729:9b4c16beea1c

[project @ 2007-06-14 22:33:56 by dbateman]
author dbateman
date Thu, 14 Jun 2007 22:33:56 +0000
parents a25173d58101
children 230f9c49857e
files scripts/pkg/pkg.m
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/pkg/pkg.m	Thu Jun 14 21:10:48 2007 +0000
+++ b/scripts/pkg/pkg.m	Thu Jun 14 22:33:56 2007 +0000
@@ -215,7 +215,7 @@
       case "-local"
 	global_install = false;
 	if (! user_prefix)
-	  prefix = fullfile ("~", "octave");
+	  prefix = tilde_expand (fullfile ("~", "octave"));
 	endif
       case "-global"
 	global_install = true;
@@ -297,7 +297,13 @@
       elseif (length (files) == 0 && nargout == 1)
 	local_packages = local_list;
       elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
-	local_list = absolute_pathname (files{1});
+	try
+	  local_list = absolute_pathname (files{1});
+	catch
+	  ## Force file to be created
+	  fclose (fopen (files{1}, 'wt'));
+	  local_list = absolute_pathname (files{1});
+	end_try_catch
       else
 	error ("you must specify a local_list file, or request an output argument");
       endif
@@ -308,7 +314,13 @@
       elseif (length (files) == 0 && nargout == 1)
 	local_packages = global_list;
       elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
-	global_list = absolute_pathname (files{1});
+	try
+	  global_list = absolute_pathname (files{1});
+	catch
+	  ## Force file to be created
+	  fclose (fopen (files{1}, 'wt'));
+	  global_list = absolute_pathname (files{1});
+	end_try_catch
       else
 	error ("you must specify a global_list file, or request an output argument");
       endif
@@ -853,7 +865,11 @@
 
 function pth = absolute_pathname (pth)
   [status, msg, msgid] = fileattrib(pth);
-  pth = msg.Name;
+  if (status != 1)
+    error ("could not find the file or path %s", pth);
+  else
+    pth = msg.Name;
+  endif
 endfunction
 
 function repackage (builddir, buildlist)