Mercurial > octave
diff src/utils.cc @ 6323:ea65de49e18e
[project @ 2007-02-17 02:51:02 by jwe]
author | jwe |
---|---|
date | Sat, 17 Feb 2007 02:51:03 +0000 |
parents | e8868fde0fc5 |
children | 41c1deed5613 |
line wrap: on
line diff
--- a/src/utils.cc Fri Feb 16 21:48:21 2007 +0000 +++ b/src/utils.cc Sat Feb 17 02:51:03 2007 +0000 @@ -113,6 +113,20 @@ return retval; } +// Return TRUE if F and G are both names for the same file. + +bool +same_file (const std::string& f, const std::string& g) +{ + std::string c_f = file_ops::canonicalize_file_name (f); + std::string c_g = file_ops::canonicalize_file_name (g); + + file_stat f_fs (c_f); + file_stat g_fs (c_g); + + return (f_fs.ino () == g_fs.ino () && f_fs.dev () == g_fs.dev ()); +} + int almost_match (const std::string& std, const std::string& s, int min_match_len, int case_sens)