comparison liboctave/util/kpse.cc @ 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 17d647821d61
children a9574e3c6e9e
comparison
equal deleted inserted replaced
20051:47d420d769ba 20052:4b7b7ac7af2c
1199 unlikely that the directory name will do anyone any good, but 1199 unlikely that the directory name will do anyone any good, but
1200 ... */ 1200 ... */
1201 } 1201 }
1202 else if (name.length () == 1) 1202 else if (name.length () == 1)
1203 { 1203 {
1204 expansion = octave_env::getenv ("HOME"); 1204 expansion = octave_env::get_home_directory ();
1205 1205
1206 if (expansion.empty ()) 1206 if (expansion.empty ())
1207 expansion = "."; 1207 expansion = ".";
1208 1208
1209 /* If '~/', remove any trailing / or replace leading // in $HOME. 1209 /* If '~/', remove any trailing / or replace leading // in $HOME.
1210 Should really check for doubled intermediate slashes, too. */ 1210 Should really check for doubled intermediate slashes, too. */
1211 } 1211 }
1212 else if (IS_DIR_SEP (name[1])) 1212 else if (IS_DIR_SEP (name[1]))
1213 { 1213 {
1214 unsigned c = 1; 1214 unsigned c = 1;
1215 std::string home = octave_env::getenv ("HOME"); 1215 std::string home = octave_env::get_home_directory ();
1216 1216
1217 if (home.empty ()) 1217 if (home.empty ())
1218 home = "."; 1218 home = ".";
1219 1219
1220 size_t home_len = home.length (); 1220 size_t home_len = home.length ();