diff scripts/miscellaneous/edit.m @ 20052:4b7b7ac7af2c

use get_home_directory instead of getenv ("HOME") (bug #44694) * files-dock-widget.cc (files_dock_widget::popdownmenu_home): Use get_home_directory instead of getenv ("HOME") for the benefit of Windows systems which may not have HOME set in the environment. * kpse.cc (kpse_tilde_expand): Likewise. * prefdir.m: Likewise. * system.tst: Likewise. * edit.m: Use get_home_directory instead of default_home. (default_home): Delete subfunction.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Apr 2015 13:19:30 -0400
parents 9fc020886ae9
children 002576bbba10
line wrap: on
line diff
--- a/scripts/miscellaneous/edit.m	Thu Apr 02 13:08:34 2015 -0400
+++ b/scripts/miscellaneous/edit.m	Thu Apr 02 13:19:30 2015 -0400
@@ -125,7 +125,8 @@
 
   ## Pick up globals or default them.
 
-  persistent FUNCTION = struct ("HOME", fullfile (default_home, "octave"),
+  persistent FUNCTION = struct ("HOME",
+                                fullfile (get_home_directory (), "octave"),
                                 "AUTHOR", default_user(1),
                                 "EMAIL", [],
                                 "LICENSE", "GPL",
@@ -164,7 +165,7 @@
         return;
       case "HOME"
         if (! isempty (stateval) && stateval(1) == "~")
-          stateval = [ default_home, stateval(2:end) ];
+          stateval = [ get_home_directory, stateval(2:end) ];
         endif
         FUNCTION.HOME = stateval;
         return;
@@ -517,20 +518,6 @@
 
 endfunction
 
-function retval = default_home ()
-
-  retval = getenv ("HOME");
-  if (isempty (retval))
-    retval = glob ("~");
-    if (! isempty (retval))
-      retval = retval{1};
-    else
-      retval = "";
-    endif
-  endif
-
-endfunction
-
 ## Return the name associated with the current user ID.
 ##
 ## If LONG_FORM is 1, return the full name.  This will be the