Exemple #1
0
Fichier : log.cpp Projet : GREO/uhd
 void log_to_file(const std::string &log_msg){
     boost::mutex::scoped_lock lock(_mutex);
     if (_file_lock == NULL){
         const std::string log_path = (get_temp_path() / "uhd.log").string();
         _file_stream.open(log_path.c_str(), std::fstream::out | std::fstream::app);
         _file_lock = new ip::file_lock(log_path.c_str());
     }
     _file_lock->lock();
     _file_stream << log_msg << std::flush;
     _file_lock->unlock();
 }
Exemple #2
0
TempDir::TempDir(const string& appName)
{
  for (int i=(std::rand()%0xffff); ; ++i) {
    m_path = join_path(get_temp_path(),
                       appName + convert_to<string>(i));

    if (!directory_exists(m_path)) {
      make_directory(m_path);
      break;
    }
  }
}
Exemple #3
0
    file::file( const std::string &_pathfile, sorting_type defaults ) :
        is_temp_name( _pathfile.size() ? false : true ),
        pathfile( _pathfile.size() ? _pathfile : std::tmpnam(0) ),
        sorting(defaults)
    {
        if( is_temp_name )
        {
            pathfile = get_temp_path() + pathfile;
        }

        // metadata here
        // ie, committed_by, date_created, last_open, last_access, vertex_info, bitrate, etc

        // valid prefixes:
        // b_ = bool
        // d_ = double
        // s_ = std::string
        // z_ = size_t
    }
Exemple #4
0
TempFile::TempFile() {
  Buffer<wchar_t> buf(MAX_PATH);
  wstring temp_path = get_temp_path();
  CHECK_SYS(GetTempFileNameW(temp_path.c_str(), L"", 0, buf.data()));
  path.assign(buf.data());
}