• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ createDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中createDir函数的典型用法代码示例。如果您正苦于以下问题:C++ createDir函数的具体用法?C++ createDir怎么用?C++ createDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了createDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: henHouse

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);
}
开发者ID:Klunkerball,项目名称:EGSnrc,代码行数:27,代码来源:egs_install.cpp


示例2: driveLetter

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;   
}
开发者ID:vivekgalatage,项目名称:widgetmanager,代码行数:57,代码来源:widgetdigitalsignvalidation.cpp


示例3: createDir

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;
}
开发者ID:tailored,项目名称:qiptables,代码行数:11,代码来源:install.cpp


示例4: createSaveDir

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));
}
开发者ID:fkeet,项目名称:flare-engine,代码行数:12,代码来源:Utils.cpp


示例5: setPaths

// 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 = "userdata";
		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 + "/";
}
开发者ID:SBasalaev,项目名称:flare-engine,代码行数:31,代码来源:Settings.cpp


示例6: createDir

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());
	}
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:15,代码来源:ManageCrossPlayerData.cpp


示例7: fn

/* 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;
}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:39,代码来源:Archive.cpp


示例8: ScutLog

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;
}
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:34,代码来源:FileHelper.cpp


示例9: while

/*
 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;
}
开发者ID:korman,项目名称:Temp,代码行数:71,代码来源:KDirectory.cpp


示例10: createDir

// -----------------------------------------------------------------------------
// 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;
}
开发者ID:sirjuddington,项目名称:SLADE,代码行数:39,代码来源:Archive.cpp


示例11: L_ERROR_P

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;
}
开发者ID:PimenovAlexander,项目名称:corecvs,代码行数:30,代码来源:folderScanner.cpp


示例12: cs1550_mkdir

/*
 * 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;
}
开发者ID:Chris-grant1995,项目名称:CS1550,代码行数:33,代码来源:cs1550.c


示例13: writeToFile

	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;
	}
开发者ID:zheng39562,项目名称:common,代码行数:28,代码来源:xls_writer.cpp


示例14: main

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;
}
开发者ID:rivadunga,项目名称:Programacion-avanzada,代码行数:29,代码来源:ej2.c


示例15: create

/* 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;
}
开发者ID:darkphase,项目名称:remotefs,代码行数:60,代码来源:perf.c


示例16: while

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));
	}
}
开发者ID:tranhuanltv,项目名称:OptimizeUsePageSpeed,代码行数:9,代码来源:DirectoryTool.cpp


示例17: saveRenderStatesUsingDrawPrimitiveCount

	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);
	}
开发者ID:dima424658,项目名称:Direct3D8to9,代码行数:11,代码来源:DebugUtils.cpp


示例18: main

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();
}
开发者ID:danrods,项目名称:xv6Hacks,代码行数:53,代码来源:lab4tests.c


示例19: createDirPath

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;
}
开发者ID:GoodRon,项目名称:OpenSR,代码行数:22,代码来源:FSUtils.cpp


示例20: createDirRecursively

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;
}
开发者ID:victor-tr,项目名称:armor2016,代码行数:51,代码来源:fs.c



注:本文中的createDir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ createDirectory函数代码示例发布时间:2022-05-30
下一篇:
C++ createDateRangeWidget函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap