string DefaultConf::createIfNonExistent ( const char *  folder,
const char *  file,
const char **  content 
) [static]

Definition at line 9 of file DefaultConf.cpp.

00009                                                                                                              {
00010         string filePath = getenv("HOME");
00011         filePath += "/";
00012         filePath += folder;
00013         mkdir(filePath.c_str(), 0750);
00014         filePath += "/";
00015         filePath += file;
00016         struct stat myStat;
00017         if ( stat(filePath.c_str(),&myStat) ) {
00018                 fstream fileStream(filePath.c_str(), ios::out|ios::trunc);
00019                 if ( fileStream.is_open() ) {
00020                         for ( int i = 0; content[i] != 0; i++ ) {
00021                                 fileStream << content[i] << endl;
00022                         }
00023                         fileStream << endl;
00024                         fileStream.close();
00025                 }
00026         }
00027         return filePath;
00028 }


Generated on Wed Jun 25 14:47:08 2008 for keyvil by  doxygen 1.5.1