예제 #1
0
void QInstallPage::createDirs(){
    QChar s = QDir::separator();
    /* Set installation status directory if not there already */
    //installationDir = henHouse() + tr("install_status") + s;
    installationDir = henHouse() + tr("log") + s;
    createDir(installationDir, false, henHouse());
    QDir::setCurrent(installationDir); //SETTING CURRENT DIR ON WRITEABLE AREA !!!!
    /* Create work area directory if not there already */
    createDir(egsHome(),true);
    /* Create work area bin directory if not there already */
    homeBinDir = egsHome() + tr("bin") + s + my_machine() + s;
    createDir(homeBinDir,true);
    /* Create pegs4 directory in work area if not there already */
    createDir(egsHome() + tr("pegs4") + s);
    createDir(egsHome() + tr("pegs4") + s + tr("inputs") + s);
    createDir(egsHome() + tr("pegs4") + s + tr("data")   + s);
    createDir(egsHome() + tr("pegs4") + s + tr("density")+ s);
    /* Create system bin directory if not there already */
    egsBinDir = henHouse() + tr("bin") + s + my_machine() + s;
    createDir(egsBinDir,true);
    /* Create system lib directory if not there already */
    egsLibDir = henHouse() + tr("lib") + s + my_machine() + s;
    createDir(egsLibDir,true);
    /* Create system dso directory if not there already */
    dsoDir = henHouse() + "egs++" + s + "dso" + s + my_machine() + s;
    createDir(dsoDir,true);
}
QString WidgetDigSignValidation::getRootDirectory( const QString& rootDirectory, const QString& processUid )
{
    QString result = NULL;
    QChar driveLetter(NULL);
    
    if ( rootDirectory.length() >= 1 ) 
    {
        driveLetter = rootDirectory[0];
        if (!driveLetter.isLetter())
            return QString();

        // Handle edge case when only drive letter is available from rootDirectory (and no subdirectories) 
        else if (rootDirectory.length() <= strlen("A:\\")) 
                result = QDir::toNativeSeparators( QString(driveLetter) + QDir::separator() + PrivateDirectory + QDir::separator() + processUid );
                
        // Use the passed driveletter and root dir
        else
        {
            QString rootDrive = rootDirectory;
            if (!(rootDrive.startsWith("\\") || rootDrive.startsWith("/")))
                rootDrive.remove(0, 2);
            QString rootPath = "";
            rootPath.append(driveLetter);
            rootPath = rootPath+':'+rootDrive;
            rootPath = QDir::toNativeSeparators(rootPath);
            result = rootPath;
        }
    } 
    else 
    {
        if (driveLetter.isNull()) {
            result = DefaultDrive + QDir::separator() + PrivateDirectory + QDir::separator() + processUid; //DefaultRootDirectory;
        }
    }
    
    QString installPath("");
    installPath = QDir::toNativeSeparators(result);
    
    if (installPath.startsWith("Z"))
        installPath.replace(0, 1, "C");
    
    QString privatePath = installPath[0]+":"+QDir::separator()+"private";
    if ( !createDir(privatePath) ) 
    {
        return QString();
    }
    
    if (! createDir(installPath)) {
        return QString();
    }
    installPath = installPath + QDir::separator() + WidgetFolder;
    
    if (! createDir(installPath)) {
        return QString();
    }
    return installPath;   
}
예제 #3
0
bool Install::createQiptablesDir()
{
    bool result = true;
    QString tmp;

    createDir(Install::INSTALL_DIR);
    createDir(QString("%1/%2").arg(Install::INSTALL_DIR).arg("tmp"));
    createDir(QString("%1/%2").arg(Install::INSTALL_DIR).arg("tools"));

    return result;
}
예제 #4
0
void createSaveDir(int slot) {
	// game slots are currently 1-4
	if (slot == 0) return;

	std::stringstream ss;
	ss << PATH_USER << "saves/" << SAVE_PREFIX << "/";

	createDir(path(&ss));

	ss << slot;
	createDir(path(&ss));
}
예제 #5
0
// Windows paths
void setPaths() {

	// handle Windows-specific path options
	if (getenv("APPDATA") != NULL) {
		PATH_CONF = PATH_USER = (std::string)getenv("APPDATA") + "\\flare";
		createDir(PATH_CONF);
		createDir(PATH_USER);

		PATH_CONF += "\\config";
		PATH_USER += "\\userdata";
		createDir(PATH_CONF);
		createDir(PATH_USER);
	}
	else {
		PATH_CONF = "config";
		PATH_USER = "******";
		createDir(PATH_CONF);
		createDir(PATH_USER);
	}

	createDir(PATH_USER + "\\mods");
	createDir(PATH_USER + "\\saves");

	PATH_DATA = "";
	if (dirExists(CUSTOM_PATH_DATA)) PATH_DATA = CUSTOM_PATH_DATA;
	else if (!CUSTOM_PATH_DATA.empty()) logError("Settings: Could not find specified game data directory.");

	PATH_CONF = PATH_CONF + "/";
	PATH_USER = PATH_USER + "/";
}
void ManageCrossPlayerData::saveData(CrossPlayerDataInfo * cross_player_data_info)
{
	createDir(CROSS_PLAYER_PATH);
	createDir(CROSS_PLAYER_PATH + cross_player_data_info->platform);
	string line_dir = CROSS_PLAYER_PATH + cross_player_data_info->platform + "/" + cross_player_data_info->line_id + "/";
	createDir(line_dir);
	string player_dir = line_dir + boost::lexical_cast<string>(cross_player_data_info->player_guid) + "/";
	createDir(player_dir);

	for (CrossPlayerDataInfo::MsgMap_t::iterator it = cross_player_data_info->msg_map.begin(); it != cross_player_data_info->msg_map.end(); ++it)
	{
		string file_name = player_dir + boost::lexical_cast<string>(it->first);
		saveFile(file_name, it->second->SerializeAsString());
	}
}
예제 #7
0
파일: Archive.cpp 프로젝트: Aeyesx/SLADE
/* Archive::importDir
 * Imports all files (including subdirectories) from [directory] into
 * the archive
 *******************************************************************/
bool Archive::importDir(string directory)
{
	// Get a list of all files in the directory
	wxArrayString files;
	wxDir::GetAllFiles(directory, &files);

	// Go through files
	for (unsigned a = 0; a < files.size(); a++)
	{
		string name = files[a];
		name.Replace(directory, "", false);	// Remove directory from entry name

		// Split filename into dir+name
		wxFileName fn(name);
		string ename = fn.GetFullName();
		string edir = fn.GetPath();

		// Remove beginning \ or / from dir
		if (edir.StartsWith("\\") || edir.StartsWith("/"))
			edir.Remove(0, 1);

		// Add the entry
		ArchiveTreeNode* dir = createDir(edir);
		ArchiveEntry* entry = addNewEntry(ename, dir->numEntries()+1, dir);

		// Load data
		entry->importFile(files[a]);

		// Set unmodified
		entry->setState(0);
		dir->getDirEntry()->setState(0);
	}

	return true;
}
예제 #8
0
bool CFileHelper::createDirs(const char* szDir)
{
    if (szDir == NULL)
    {
        ScutLog("createDirs Error %s %d", szDir, __LINE__);
        return false;
    }

    const char *pBegin = szDir;
    const char *pend = szDir;
    do 	{
        char szBuf[MAX_PATH];
        pend = strchr(pend,FILE_SEP);
        if (NULL != pend)
        {
            ++pend;
            int nSize = pend-pBegin;
            memcpy(szBuf,pBegin,nSize);
            szBuf[nSize] = '\0';
            std::string dir;
            dir = szBuf;
            if (!isDirExists(dir.c_str()))
            {
                if(!createDir(dir.c_str()))
                {
                    ScutLog("createDirs Error %s %d", szDir, __LINE__);
                    break;
                }
            }
        }
    } while (NULL != pend);

    return true;
}
예제 #9
0
파일: KDirectory.cpp 프로젝트: korman/Temp
/*
 bool KDirectory::isDirEmpty( const KData& fullDir )
 {
 KData dtDir = fullDir;
 dtDir.makePath( true );
 DIR* dir;
 if ( (dir=opendir(dtDir.getData())) == NULL )
 return false;
 struct dirent *pDirent;
 while( ( pDirent = readdir(dir) ) != NULL  )
 {
 struct stat statbuf;
 KData dtPath = dtDir;
 dtPath += pDirent->d_name;
 if ( stat(dtPath.getData(),&statbuf) == -1 )
 continue;
 if ( S_ISDIR(statbuf.st_mode) )
 {
 if ( pDirent->d_name && strcmp(pDirent->d_name,".") && strcmp(pDirent->d_name,"..") )
 {
 if ( !isDirEmpty(dtPath) )
 {
 closedir( dir );
 return false;
 }
 }
 }
 else
 {
 closedir( dir );
 return false;
 }
 }
 closedir( dir );
 return true;

 }
 */
bool KDirectory::open(const KData& directory, bool create)
{
	if (directory.isEmpty())
	{
		return false;
	}

	KData dir = directory;
	int pos;
	KData dtKData = "\\";
	while ((pos = dir.find(dtKData)) != -1)
	{
		dir.replace(pos, 1, "/");
	}
	_directory.erase();

	bool bDirExist = isDirectoryExist(dir);
	if (!bDirExist)
	{
		if (create)
		{
			if (!createDir(dir))
				return false;
		}
		else
		{
			return false;
		}
	}
	_directory = dir;
	_directory.makePath();
	return true;
}
예제 #10
0
// -----------------------------------------------------------------------------
// Imports all files (including subdirectories) from [directory] into the
// archive
// -----------------------------------------------------------------------------
bool Archive::importDir(string_view directory)
{
	// Get a list of all files in the directory
	vector<string> files;
	for (const auto& item : std::filesystem::recursive_directory_iterator{ directory })
		if (item.is_regular_file())
			files.push_back(item.path().string());

	// Go through files
	for (const auto& file : files)
	{
		StrUtil::Path fn{ StrUtil::replace(file, directory, "") }; // Remove directory from entry name

		// Split filename into dir+name
		auto ename = fn.fileName();
		auto edir  = fn.path();

		// Remove beginning \ or / from dir
		if (StrUtil::startsWith(edir, '\\') || StrUtil::startsWith(edir, '/'))
			edir.remove_prefix(1);

		// Add the entry
		auto dir   = createDir(edir);
		auto entry = addNewEntry(ename, dir->numEntries() + 1, dir);

		// Load data
		entry->importFile(file);

		// Set unmodified
		entry->setState(ArchiveEntry::State::Unmodified);
		dir->dirEntry()->setState(ArchiveEntry::State::Unmodified);
	}

	return true;
}
예제 #11
0
bool FolderScanner::createDir(const string &path, bool allowRecursive)
{
    if (isDir(path))
        return true;

    std::cout << "creating dir <" << path << ">" << std::endl;

    std::system(("mkdir " + path).c_str());

    if (!isDir(path))
    {
        if (!allowRecursive) {
            L_ERROR_P("couldn't create dir <%s>", path.c_str());
            return false;
        }
        L_INFO_P("creating subfolders of <%s>", path.c_str());

        auto subfolders = HelperUtils::stringSplit(path, PATH_SEPARATOR[0]);
        string p;
        for (auto& subfolder : subfolders)
        {
            if (!p.empty()) p += PATH_SEPARATOR;
            p += subfolder;

            if (!createDir(p, false))
                return false;
        }
    }
    return true;
}
예제 #12
0
/*
 * Creates a directory. We can ignore mode since we're not dealing with
 * permissions, as long as getattr returns appropriate ones for us.
 */
static int cs1550_mkdir(const char *path, mode_t mode)
{
	(void) mode;

	char dir[MAX_FILENAME + 1];
	char fileName[MAX_FILENAME + 1];
	char ext[MAX_EXTENSION + 1];

	getPath(path, dir, fileName, ext);
	int pathType = getPathType(path, dir, fileName, ext);

	if (strlen(dir) >= MAX_FILENAME) {
		return -ENAMETOOLONG;
	}
	else if (dirExists(dir) == 1){
			return -EEXIST;
	}
	else if (pathType != 1){
		return -EPERM;
	}
	else {
				cs1550_root_directory r;
				getRoot(&r);
				if (r.nDirectories < MAX_DIRS_IN_ROOT) {
					createDir(dir);
				}
			}
	return 0;
}
예제 #13
0
	bool XlsWriter::writeToFile( const string &filePath, const XlsSheetStruct &xlsSheet, SheetFormat sheetFormat ){
		string folderPath = filePath.substr( 0, filePath.find_last_of('/', filePath.size() )+1 );
		if( !createDir( folderPath ) )  return false;
	
		workbook wb;
		worksheet *ws;
		xf_t *xf = wb.xformat();
		ws = wb.sheet("sheet1");

		cell_t *p_Cell;
		int line(0), column(0);
		for( XlsSheetStruct::const_iterator citerRow = xlsSheet.begin(); citerRow != xlsSheet.end(); ++citerRow ){
			column = 0;
			for( XlsRowStruct::const_iterator citer = citerRow->begin(); citer != citerRow->end(); ++citer ){
				p_Cell = ws->label( line, column, *citer, xf );
				//p_Cell->fontcolor( (xlslib_core::color_name_t)getXlsColor( sheetFormat.getFontColor( line, column ) ) );
				int long_color = getXlsColor( sheetFormat.getFontColor( line, column ) );
//				int long_color = CLR_RED;
				p_Cell->fontcolor( (xlslib_core::color_name_t)(long_color) );
				++column;
			}
			++line;
		}

		wb.Dump( filePath);

		return true;
	}
예제 #14
0
int main(int argc, char *argv[])
{
    int  i      = 0;
    int  numDir = 5;
    FILE *file  = NULL;
    char *buffer[20];

    signal(SIGALRM, SIG_DFL);
    alarm(2);
    signal(SIGALRM, handler_alarm);
    createDir();

    for (i = 0; i < numDir; i++)
    {
        printf("Creando archivos\n");
        int signal;
        flag = 1;
        file = fopen(buffer, "w+");
        sprintf(buffer, "./Data/a%d", i);
        alarm(3);
        while (flag)
            fputc('x', file);
        fclose(file);
    }
    printf("INFO\n\n");
    printDir();

    return 0;
}
예제 #15
0
파일: perf.c 프로젝트: darkphase/remotefs
/* main test functions */
int create(void)
{
   char buf[4096];
   char *s;
   int i;
   int ret = 1;
   char *spec;
   if ( ret && createDir(testDir) )
      ret = 0;

   if ( totalSize < maxSize )
   {
       maxSize = totalSize;
   }
   int nb = maxSize;
   spec = specToName(0, nb, csv);

   STARTTIME();
   for(i=0;i < nb &&createFileBefore;i++)
   {
      snprintf(buf,sizeof(buf), "%s/f_%d",testDir,i);
      int fd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0666);
      if ( fd > 0 )
      {
         close(fd);
      }
      else
      {
         ret = 0;
         break;
      }
   }
   ENDTIME();
   SETDT();
   double createPerSecond = nb*1000000.0/dt;

   fprintf(stdout,"Create %-18s time %8.3f sec %8.0f     F/s\n",
           spec,
           (double)dt/1000000,
           createPerSecond
           );
   STARTTIME();
   for(i=0;i < nb; i++)
   {
      snprintf(buf,sizeof(buf),"%s/f_%d",testDir,i);
      deleteFile(buf);
   }
   ENDTIME();
   SETDT();
   createPerSecond = nb*1000000.0/dt;
   fprintf(stdout,"Delete %-18s time %8.3f sec %8.0f     F/s\n",
           spec,
           (double)dt/1000000,
           createPerSecond
           );
   
   deleteTestDir(1);
   return ret;
}
void DirectoryTool::createDirTree( const std::string& full_path )
{
	size_t pos = 0;
	while(pos != std::string::npos)
	{
		pos = full_path.find(SLASH_CHAR, pos + 1);
		createDir(full_path.substr(0, pos));
	}
}
예제 #17
0
// Android paths
void setPaths() {

	PATH_CONF = std::string(SDL_AndroidGetInternalStoragePath()) + "/config";
	PATH_USER = std::string(SDL_AndroidGetInternalStoragePath()) + "/userdata";
	createDir(PATH_CONF);
	createDir(PATH_USER);
	createDir(PATH_USER + "/mods");
	createDir(PATH_USER + "/saves");

	std::string mods_folder = "data/org.flare.app/files";

	if (SDL_AndroidGetExternalStorageState() != 0)
	{
		PATH_DATA = std::string(SDL_AndroidGetExternalStoragePath());
	}
	else if (dirExists("/sdcard/Android"))
	{
		PATH_DATA = "/sdcard/Android/" + mods_folder;
	}
	else if (dirExists("/mnt/sdcard/Android"))
	{
		PATH_DATA = "/mnt/sdcard/Android/" + mods_folder;
	}
	else if (dirExists("storage/sdcard0/Android"))
	{
		PATH_DATA = "/storage/sdcard0/Android/" + mods_folder;
	}
	else if (dirExists("/storage/emulated/0/Android"))
	{
		PATH_DATA = "/storage/emulated/0/Android/" + mods_folder;
	}
	else if (dirExists("/storage/emulated/legacy/Android"))
	{
		PATH_DATA = "/storage/emulated/legacy/Android/" + mods_folder;
	}
	else
	{
		logError("Settings: Android external storage unavailable: %s", SDL_GetError());
	}

	PATH_CONF = PATH_CONF + "/";
	PATH_USER = PATH_USER + "/";
	PATH_DATA = PATH_DATA + "/";
}
예제 #18
0
	void saveRenderStatesUsingDrawPrimitiveCount(IDirect3DDevice9* pd3dDevice)
	{
		char fullPath[64]="pics/";
		char fileName[16];
		char fileSuffix[8]=".txt";
		createDir(fullPath);
		itoa(g_dbDrawPrimitiveCount, fileName, 10);
		strcat(fullPath, fileName);
		strcat(fullPath, fileSuffix);
		saveRenderStatesToFile(pd3dDevice, fullPath);
	}
예제 #19
0
int
main(void) {
	static const char DIRNAME = "newDir";
	static const char FILENAME = "newFile";
	static const char LARGEFILE = "LargeFile";
	static const int SIZE = 128000;	 // 16KB

	// First Heuristic Test
	printf("Test I: a new directory placement");
	printBStats();

	int path = createDir(*DIRNAME);

	// Not created
	if (path == -1)
	{
		printf("ERROR: Failed to create the directory");
		exit();
	}
	else {
		printBStats();
	}

	// Second Heuristic Test
	printf("Test II: a new file placement");

	int file = createFile(*FILENAME);
	if (file == -1)
	{
		printf("ERROR: Failed to create the file");
		exit();
	}
	else 
	{
		printBStats();
	}


	// Third Heuristic Test
	printf("Test II: a new file placement");
	int bigFile = createFile(*FILENAME, SIZE);
	if (bigFile == -1)
	{
		printf("ERROR: Failed to create the big file");
		exit();
	}
	else {
		printBStats();
	}


	exit();
}
예제 #20
0
/* ZipArchive::addEntry
 * Adds [entry] to the end of the namespace matching [add_namespace].
 * If [copy] is true a copy of the entry is added. Returns the added
 * entry or NULL if the entry is invalid
 *
 * In a zip archive, a namespace is simply a first-level directory,
 * ie <root>/<namespace>
 *******************************************************************/
ArchiveEntry* ZipArchive::addEntry(ArchiveEntry* entry, string add_namespace, bool copy)
{
	// Check namespace
	if (add_namespace.IsEmpty() || add_namespace == "global")
		return Archive::addEntry(entry, 0xFFFFFFFF, NULL, copy);

	// Get/Create namespace dir
	ArchiveTreeNode* dir = createDir(add_namespace.Lower());

	// Add the entry to the dir
	return Archive::addEntry(entry, 0xFFFFFFFF, dir, copy);
}
예제 #21
0
파일: FSUtils.cpp 프로젝트: GoodRon/OpenSR
bool createDirPath(const std::string& path)
{
#ifdef WIN32
    //FIXME: Will work only on WinXP SP2 or newer.
    std::wstring wp = fromUTF8(directory(path).c_str());
    int result = SHCreateDirectoryExW(NULL, wp.c_str(), NULL);
    if ((result != ERROR_SUCCESS) && (result != ERROR_FILE_EXISTS) && (result != ERROR_ALREADY_EXISTS))
        return false;
#else
    int startPos = 0;
    int endPos = 0;
    while ((endPos = path.find(L'/', startPos)) != std::string::npos)
    {
        if (createDir(path.substr(0, endPos + 1).c_str(), 0777))
            return false;
        startPos = endPos + 1;
    }
    if (createDir(path.c_str(), 0777))
        return false;
#endif
    return true;
}
예제 #22
0
파일: fs.c 프로젝트: victor-tr/armor2016
bool createDirRecursively(char *dirName)
{
    OUT_DEBUG_2("createDirRecursively(\"%s\")\r\n", dirName);

    if (!Ql_strlen(dirName)) {
        OUT_DEBUG_1("Directory name is empty\r\n");
        return FALSE;
    }

    // -- create dirs hierarchy
    char parted_dir_name[255] = {0};
    Ql_strcpy(parted_dir_name, dirName);

    s16 nPathParts = 0;
    char *temp_str = parted_dir_name;
    const char path_separator = '\\';

    do {
        temp_str = Ql_strchr(temp_str, path_separator);
        if (temp_str) *temp_str++ = 0;
        ++nPathParts;
    } while (temp_str);

    while (nPathParts) {
        if (nPathParts-- > 1) {  // if not last iteration
            s32 ret = Ql_FS_CheckDir(parted_dir_name);
            if (ret < QL_RET_OK && QL_RET_ERR_FILENOTFOUND != ret) // if an error occured
            {
                OUT_DEBUG_1("Error %d occured while checking directory \"%s\".\r\n",
                            ret, parted_dir_name);
                return FALSE;
            }
            else if (QL_RET_OK == ret) // if the dir was found
            {
                OUT_DEBUG_3("Directory \"%s\" already exists. Creation skipped\r\n", parted_dir_name);
                char *end = Ql_strchr(parted_dir_name, 0);  // find the end of the dir name's part
                *end = path_separator;
                continue;
            }
        }

        // -- create dest dir
        if (!createDir(parted_dir_name))
            return FALSE;

        char *end = Ql_strchr(parted_dir_name, 0);  // find the end of the dir name's part
        *end = path_separator;
    }

    return TRUE;
}
예제 #23
0
	bool copyDir(const char* dirSrcName, const char* dirDstName)
	{
		PHYSFS_Stat stat;
		if (PHYSFS_stat(dirSrcName, &stat) == 0 ||
			stat.filetype != PHYSFS_FILETYPE_DIRECTORY)
		{
			return false;
		}
		if (PHYSFS_stat(dirDstName, &stat) != 0 &&
			stat.filetype != PHYSFS_FILETYPE_DIRECTORY)
		{
			return false;
		}

		createDir(dirDstName);
		auto paths = PHYSFS_enumerateFiles(dirSrcName);
		if (paths != nullptr)
		{
			for (char** path = paths; *path != nullptr; path++)
			{
				auto fullSrcPath = std::string(dirSrcName) + '/' + *path;
				auto fullDstPath = std::string(dirDstName) + '/' + *path;

				if (PHYSFS_stat(fullSrcPath.c_str(), &stat) == 0)
				{
					continue;
				}
				if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY)
				{
					copyDir(fullSrcPath.c_str(), fullDstPath.c_str());
				}
				else
				{
					// copy file (read source file and write destination)
					sf::PhysFSStream fileRead(fullSrcPath);
					auto fileWrite = PHYSFS_openWrite(fullDstPath.c_str());
					if (fileRead.hasError() == false &&
						fileWrite != nullptr)
					{
						std::vector<uint8_t> data((size_t)fileRead.getSize());
						fileRead.read(data.data(), fileRead.getSize());
						PHYSFS_writeBytes(fileWrite, data.data(), data.size());
						PHYSFS_close(fileWrite);
					}
				}
			}
			PHYSFS_freeList(paths);
			return true;
		}
		return false;
	}
예제 #24
0
void TTileL3Cache::addTile(TTileCompressed *tile)
{
	createDir(tile->ref());
	QString filename = buildName(tile->ref());

	QMutexLocker locker(&_mutex);

	QFile file(filename);
	if(!file.open(QIODevice::WriteOnly)) {
		qDebug() << "Error opening file for write: " << filename;
	} else {
		file.write(*tile);
	}
}
bool DirectoryTool::createDirs(const vector<string>& dirs, const string& fromDir, const string& toDir)
{
    for (int i = 0; i < dirs.size(); ++i)
    {
        string dir = StringUtil::replace(dirs.at(i), fromDir, toDir);
        if (!createDir(dir))
		{
			printf("Failed create: %s\n", dir.c_str());
            return false;
		}
    }
    
    return true;
}
void
InitWillhabentracker::init()
{
    DBGINIT(std::cerr, Logger::INFO | Logger::ERRO | Logger::VERB | Logger::DEBU)
    
    std::string config_filename = "/Users/minhdt/Documents/softwares/willhabentracker/config.cfg";
    
    DBGINFO("Read config")
    
    ConfigurationWillhabentracker* config = ConfigurationWillhabentracker::instance();
    config->readConfig(config_filename);
    
    if (!exists(config->pathDatabase())) createDir(config->pathDatabase());
}
예제 #27
0
파일: newcs.c 프로젝트: stackprobe/Factory
static void Main2(char *tmplProject, char *tmplDir, int utFlag, int m2Flag)
{
	char *project = nextArg();

	errorCase(!existDir(tmplDir)); // 2bs ?

	errorCase_m(!lineExp("<1,30,__09AZaz>", project), "不正なプロジェクト名です。");
	errorCase_m(existPath(project), "既に存在します。");

	createDir(project);
	copyDir(tmplDir, project);

	addCwd(project);
	{
		coExecute("qq -f");

		RenamePaths(tmplProject, project);

		addCwd(existDir(TESTER_PROJ_LDIR) ? TESTER_PROJ_LDIR : project);
		{
			ChangeAppIdent("Program.cs");

			if(utFlag)
			{
				char *csprojFile = xcout("%s.csproj", project);

				if(existFile(csprojFile))
				{
					ResolveRelHintPath(csprojFile);
				}
				memFree(csprojFile);
			}
		}
		unaddCwd();

		removeFileIfExist("C:\\Factory\\tmp\\Sections.txt"); // 意図しない検索結果を trep しないように、念のため検索結果をクリア

		coExecute_x(xcout("Search.exe %s", tmplProject));
		coExecute_x(xcout("trep.exe /F %s", project));

//		execute("START .");

		execute_x(xcout("%s.sln", project));

		if(m2Flag)
			execute("START C:\\Dev\\CSharp\\Module2\\Module2");
	}
	unaddCwd();
}
예제 #28
0
static int createDirCallback(direntry_t *entry, MainParam_t *mp)
{
	Stream_t *ret;
	time_t now;

	ret = createDir(mp->File, mp->targetName, &((Arg_t *)(mp->arg))->ch, 
					ATTR_DIR, getTimeNow(&now));
	if(ret == NULL)
		return ERROR_ONE;
	else {
		FREE(&ret);
		return GOT_ONE;
	}
	
}
예제 #29
0
파일: platform.cpp 프로젝트: alexsaen/Roots
std::string	loadSettings() {
	std::string dataDir = std::string(getenv("APPDATA")) + "\\Roots";
	createDir(dataDir);
	settingsFilename = dataDir + "\\settings";
	std::ifstream is(settingsFilename.c_str());
	std::string result;
	if(!is)
		return result;
	while(!is.eof()) {
		std::string s;
		std::getline(is, s);
		result += s + "\n";
	}
	return result;
}
예제 #30
0
/*!
    \fn KmlExport::createDir(QDir dir)
 */
bool KmlExport::createDir(const QDir& dir) const
{
    if (dir.exists()) return true;

    QDir parent = dir;
    parent.cdUp();
    bool ok     = createDir(parent);

    if (!ok)
    {
        logError(i18n("Could not create '%1'", parent.path()));
        return false;
    }

    return parent.mkdir(dir.dirName());
}