#ifndef autil_file_util__hh
#define autil_file_util__hh

#include <fstream>
#include <string>
#include <ctime>

namespace autil {
  void open_file(ifstream & in, const string & file, int mode = ios::in);
  string add_possible_dir(const string & dir, const string & file);
  time_t get_modification_time(fstream & f);
  void open_file_readlock(fstream & in, const string & file);
  bool open_file_writelock(fstream & in, const string & file);
  // returns true if the file already exists
  void truncate_file(fstream & f, const string & name);
  bool remove_file(const string & name);
  bool file_exists(const string & name);
  bool rename_file(const string & orig, const string & new_name);
  int filedesc(fstream & f);
}

#endif
