Mercurial > hg > octave-lyh
diff src/load-path.cc @ 8330:8303f0e912bc
load-path.cc (load_path::dir_info::update): simplify previous change
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Nov 2008 23:03:37 -0500 |
parents | c91b59532f32 |
children | 7418596586c3 |
line wrap: on
line diff
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -52,28 +52,28 @@ void load_path::dir_info::update (void) { - if (is_relative) + file_stat fs (dir_name); + + if (fs) { - std::string abs_name - = octave_env::make_absolute (dir_name, octave_env::getcwd ()); - - abs_dir_cache_iterator p = abs_dir_cache.find (abs_name); - - if (p != abs_dir_cache.end ()) + if (is_relative) { - // The directory is in the cache of all directories we have - // visited (indexed by its absolute name). If it is out of - // date, initialize it. Otherwise, copy the info from the - // cache. By doing that, we avoid unnecessary calls to stat - // that can slow things down tremendously for large - // directories. + std::string abs_name + = octave_env::make_absolute (dir_name, octave_env::getcwd ()); + + abs_dir_cache_iterator p = abs_dir_cache.find (abs_name); - const dir_info& di = p->second; + if (p != abs_dir_cache.end ()) + { + // The directory is in the cache of all directories we have + // visited (indexed by its absolute name). If it is out of + // date, initialize it. Otherwise, copy the info from the + // cache. By doing that, we avoid unnecessary calls to stat + // that can slow things down tremendously for large + // directories. - file_stat fs (dir_name); + const dir_info& di = p->second; - if (fs) - { if (fs.mtime () != di.dir_mtime) initialize (); else @@ -81,18 +81,8 @@ return; } - else - { - std::string msg = fs.error (); - warning ("load_path: %s: %s", dir_name.c_str (), msg.c_str ()); - } } - } - file_stat fs (dir_name); - - if (fs) - { if (fs.mtime () != dir_mtime) initialize (); }