# # patch "ChangeLog" # from [fceff6f8f84a3516265794b9bcf540b02854b1c1] # to [1c28a602d45adcdeca89eb9b1270c4be05988069] # # patch "file_io.cc" # from [17fb90ea9f1ab88b9178533ad6155a38abedee5b] # to [fabe4ff3fc7938a63350416b31446b04d5e331b6] # ======================================================================== --- ChangeLog fceff6f8f84a3516265794b9bcf540b02854b1c1 +++ ChangeLog 1c28a602d45adcdeca89eb9b1270c4be05988069 @@ -1,5 +1,10 @@ 2005-08-25 Nathaniel Smith + * file_io.cc (path_exists, directory_exists, file_exists): + Implement. + +2005-08-25 Nathaniel Smith + * platform.hh (get_path_status): New function. * unix/fs.cc (get_path_status): Implement. * win32/fs.cc (get_path_status): Implement inefficiently (does ======================================================================== --- file_io.cc 17fb90ea9f1ab88b9178533ad6155a38abedee5b +++ file_io.cc fabe4ff3fc7938a63350416b31446b04d5e331b6 @@ -21,38 +21,22 @@ using namespace std; -// A path::state can be used as a boolean context for exists/doesn't exist, -// or can be used in a switch statement to consider all possibilities. -namespace path -{ - typedef enum - { - nonexistent = 0, - directory = 1, - file = 2, - } state; -}; -path::state path_state(any_path const & path); - - - bool -directory_exists(any_path const & p) +path_exists(any_path const & p) { - return fs::exists(p.as_external()) && - fs::is_directory(p.as_external()); + return get_path_status(p) != path::nonexistent; } bool -file_exists(file_path const & p) +directory_exists(any_path const & p) { - return fs::exists(localized(p)); + return get_path_status(p) == path::directory; } bool -file_exists(local_path const & p) +file_exists(any_path const & p) { - return fs::exists(localized(p)); + return get_path_status(p) == path::file; } bool