当前位置: 首页>>代码示例>>C++>>正文


C++ CreatePath函数代码示例

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


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

示例1: CreatePath

///////////////////////////////		private method		/////////////////////////////////
// C:/1/2/3/
// 012345678
BOOL CommonStrMethod::_CreatePath(CString strPath)
{
	if(::PathFileExists(strPath))
	{
		return TRUE;
	}
	else
	{
		int iIndex = strPath.ReverseFind('/');
		if(iIndex < 2)
		{
			return FALSE;
		}
		CString strParent = strPath.Left(iIndex);
		if(::PathFileExists(strParent))
		{
			return ::CreateDirectory(strPath, NULL);
		}
		else
		{
			if(CreatePath(strParent))
			{
				return CreatePath(strPath);
			}
			else
			{
				return FALSE;
			}
		}
	}
}
开发者ID:Forlearngit,项目名称:HallQueFront,代码行数:34,代码来源:CommonStrMethod.cpp

示例2: TEST_F

TEST_F(kodFileTest, WriteFileWithMultipleEntries) {
	kod_db_file = estrdup(CreatePath("kod-output-multiple", OUTPUT_DIR).c_str());

	add_entry("example.com", "RATE");
	add_entry("192.0.2.1", "DENY");
	add_entry("192.0.2.5", "RSTR");

	/*
	 * Manipulate timestamps. This is a bit of a hack, ideally these
	 * tests should not care about the internal representation.
	 */
	kod_db[0]->timestamp = 0xabcd;
	kod_db[1]->timestamp = 0xabcd;
	kod_db[2]->timestamp = 0xabcd;

	write_kod_db();

	// Open file and compare sizes and content.
	ifstream actual(kod_db_file, ios::binary);
	ifstream expected(CreatePath("kod-expected-multiple", INPUT_DIR).c_str());
	ASSERT_TRUE(actual.good());
	ASSERT_TRUE(expected.good());
	
	ASSERT_EQ(GetFileSize(expected), GetFileSize(actual));

	CompareFileContent(expected, actual);
}
开发者ID:benjit89,项目名称:ntp,代码行数:27,代码来源:kodFile.cpp

示例3: strcpy_safe

bool MEmblemMgr::CreateCache()
{
	TCHAR szEmblemPath[MAX_PATH]="";
	TCHAR szPath[MAX_PATH]="";

	if(GetMyDocumentsPath(szPath)) {
		strcpy_safe(szEmblemPath, szPath);
		strcat_safe(szEmblemPath, GUNZ_FOLDER);
		CreatePath(szEmblemPath);

		strcat_safe(szEmblemPath, MPATH_EMBLEMFOLDER);
		CreatePath(szEmblemPath);

		strcat_safe(szEmblemPath, MPATH_EMBLEMFILE);
	} else {
		return false;
	}

	MXmlDocument	xmlDoc;

	xmlDoc.Create();
	bool bResult = xmlDoc.SaveToFile(szEmblemPath);
	xmlDoc.Destroy();

	return bResult;
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:26,代码来源:MEmblemMgr.cpp

示例4: DeleteFiles

	bool DeleteFiles(const TString& directory, const TString& extension)
	{
		WIN32_FIND_DATA findData;
		bool result = true;
        TString searchPath = CreatePath(directory, TString(TEXT("*")) + extension);
        HANDLE hFind = FindFirstFile(searchPath.c_str(), &findData);
        if(hFind != INVALID_HANDLE_VALUE)
        {
            do
            {
                TString name = findData.cFileName;
                if(name != TEXT(".") && name != TEXT(".."))
                {
                    TString pathForDel = CreatePath(directory, name);
                    
                    if(!DeleteFile(pathForDel.c_str()))
                    {
                        result = false;
                        break;
                    }
                }
            } while(FindNextFile(hFind, &findData));
            FindClose(hFind);
        }
		return result;
	}
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:26,代码来源:adFileUtils.cpp

示例5: CreatePath

bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName)
{
#ifdef _WIN_ALL
  // If we are in Windows, let's try Unicode path first. In Unix we do not
  // need it (Unix MakeDir will fails with Unicode only name).
  if (PathW!=NULL && *PathW!=0)
    return(CreatePath(PathW,SkipLastName));
#endif
  if (Path!=NULL && *Path!=0)
    return(CreatePath(Path,SkipLastName));
  return(false);
}
开发者ID:ajnelson,项目名称:bulk_extractor,代码行数:12,代码来源:filefn.cpp

示例6: main

int main(){
	scanf("%d%d",&n,&m);
	AdjacentMatrix.Size = n;
	for(int i = 0; i < m; i++){
		int start,end;
		scanf("%d%d",&start,&end);
		CreatePath(start,end);
		CreatePath(end,start);
	}
	int ans = BFS(n);
	printf("%d\n",ans);
	return 0;
}
开发者ID:hellozts4120,项目名称:data-structure,代码行数:13,代码来源:无线广播(Broadcast).cpp

示例7: TEST

TEST(utilities, DebugLfpOutputDecimalFormat) {
	const char *filename = CreatePath("debug-output-lfp-dec", OUTPUT_DIR);
	InitDebugTest(filename);

	l_fp test;
	test.l_ui = 6310; // 0x000018A6
	test.l_uf = 308502; // 0x00004B516

	l_fp network;
	HTONL_FP(&test, &network);

	l_fp_output_dec(&network, outputFile);

	FinishDebugTest(CreatePath("debug-input-lfp-dec", INPUT_DIR), filename);
}
开发者ID:traveller42,项目名称:ntpsec,代码行数:15,代码来源:utilities.c

示例8: M_GetConfigPath

FString M_GetConfigPath(bool for_reading)
{
    FString path;

    // Construct a user-specific config name
    if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path))
    {
        path += "/" GAME_DIR;
        CreatePath(path);
        path += "/" GAMENAMELOWERCASE ".ini";
    }
    else
    {
        path = progdir;
        path += GAMENAMELOWERCASE ".ini";
    }

    // If we are reading the config file, check if it exists. If not, fallback
    // to $PROGDIR/zdoom.ini
    if (for_reading)
    {
        if (!FileExists(path))
        {
            path = progdir;
            path << GAMENAMELOWERCASE ".ini";
        }
    }

    return path;
}
开发者ID:RusselCS,项目名称:TheEntireGreekAlphabet,代码行数:30,代码来源:m_specialpaths.cpp

示例9: GetNewNameForFileDigit

	TString GetNewNameForFileDigit(const TPath &oldPath, const TString &nameWithoutDigit, __int64 & counter, size_t & leadingZeros, const TPath &pathForRename)
    {
		TString pathWithDigit;
		const int BUFFER_SIZE = 65;
		char buffer[BUFFER_SIZE];
		TString leadingZeroString;

		counter++;
		if (leadingZeros > 0)
		{
			if (LengthOfLong(counter) > LengthOfLong(counter - 1)) //если цифра удленилась
               leadingZeros--;
			for (size_t i = 0; i < leadingZeros; i++)
				leadingZeroString.push_back('0');
		}

		if (_i64toa_s(counter, buffer, BUFFER_SIZE, 10) == 0)
		{
			pathWithDigit = CreatePath(oldPath.GetDirectory(), nameWithoutDigit + leadingZeroString + TString(buffer) + oldPath.GetExtension());
			if(TPath::EqualByNameWithExtension(pathWithDigit, pathForRename))
				return pathForRename.Original();
			if (IsFileExists(pathWithDigit.c_str())) //если такой файл уже есть, то не увеличиваем номер, а добавляем _2
				return GetNewNameForFileAdd(oldPath);
		}
		else
			return GetNewNameForFileAdd(oldPath);
		return pathWithDigit;
    }
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:28,代码来源:adFileUtils.cpp

示例10: while

void BezierController::CheckCreatePath()
{
   bool shouldCreatePath = false;

   CurveNode* current = mStartNode.get();

   while (current)
   {
      if (current->GetDirtyFlag())
      {
         shouldCreatePath = true;
         current->SetDirtyFlag(false);
         //note: we wont break cause we need
         //to reset all dirty flags
      }

      current = current->GetNext();
   }

   if (shouldCreatePath)
   {
      CreatePath();
      ResetIterators();
   }
}
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:25,代码来源:beziercontroller.cpp

示例11: FinishSprite

/*
   ==============
   FinishSprite
   ==============
 */
void FinishSprite( void ){
	FILE    *spriteouthandle;
	int i, curframe;
	dsprite_t spritetemp;
	char savename[1024];

	if ( sprite.numframes == 0 ) {
		return;
	}

	if ( !strlen( spritename ) ) {
		Error( "Didn't name sprite file" );
	}

	sprintf( savename, "%s%s.sp2", gamedir, spritename );

	if ( g_release ) {
		char name[1024];

		sprintf( name, "%s.sp2", spritename );
		ReleaseFile( name );
		spritename[0] = 0;      // clear for a new sprite
		sprite.numframes = 0;
		return;
	}


	printf( "saving in %s\n", savename );
	CreatePath( savename );
	spriteouthandle = SafeOpenWrite( savename );


//
// write out the sprite header
//
	spritetemp.ident = LittleLong( IDSPRITEHEADER );
	spritetemp.version = LittleLong( SPRITE_VERSION );
	spritetemp.numframes = LittleLong( sprite.numframes );

	SafeWrite( spriteouthandle, &spritetemp, 12 );

//
// write out the frames
//
	curframe = 0;

	for ( i = 0 ; i < sprite.numframes ; i++ )
	{
		frames[i].width = LittleLong( frames[i].width );
		frames[i].height = LittleLong( frames[i].height );
		frames[i].origin_x = LittleLong( frames[i].origin_x );
		frames[i].origin_y = LittleLong( frames[i].origin_y );
	}
	SafeWrite( spriteouthandle, frames, sizeof( frames[0] ) * sprite.numframes );

	fclose( spriteouthandle );

	spritename[0] = 0;      // clear for a new sprite
	sprite.numframes = 0;
}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:65,代码来源:sprites.c

示例12: ExtractLink

bool ExtractLink(ComprDataIO &DataIO,Archive &Arc,const char *LinkName,uint &LinkCRC,bool Create)
{
#if defined(SAVE_LINKS) && defined(_UNIX)
  char LinkTarget[NM];
  if (IsLink(Arc.NewLhd.FileAttr))
  {
    int DataSize=Min(Arc.NewLhd.PackSize,sizeof(LinkTarget)-1);
    DataIO.UnpRead((byte *)LinkTarget,DataSize);
    LinkTarget[DataSize]=0;
    if (Create)
    {
      CreatePath(LinkName,NULL,true);
      if (symlink(LinkTarget,LinkName)==-1) // Error.
        if (errno==EEXIST)
          Log(Arc.FileName,St(MSymLinkExists),LinkName);
        else
        {
          Log(Arc.FileName,St(MErrCreateLnk),LinkName);
          ErrHandler.SetErrorCode(RARX_WARNING);
        }
      // We do not set time of created symlink, because utime changes
      // time of link target and lutimes is not available on all Linux
      // systems at the moment of writing this code.
    }
    int NameSize=Min(DataSize,strlen(LinkTarget));
    LinkCRC=CRC(0xffffffff,LinkTarget,NameSize);
    return(true);
  }
#endif
  return(false);
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:31,代码来源:ulinks.cpp

示例13: M_GetSavegamesPath

FString M_GetSavegamesPath()
{
	FString path;

	if (!UseKnownFolders())
	{
		return progdir;
	}
	// Try standard Saved Games folder
	else if (GetKnownFolder(-1, FOLDERID_SavedGames, true, path))
	{
		path << "/" GAMENAME;
	}
	// Try defacto My Documents/My Games folder
	else if (GetKnownFolder(CSIDL_PERSONAL, FOLDERID_Documents, true, path))
	{
		// I assume since this isn't a standard folder, it doesn't have
		// a localized name either.
		path << "/My Games/" GAMENAME;
		CreatePath(path);
	}
	else
	{
		path = progdir;
	}
	return path;
}
开发者ID:Marqt,项目名称:ViZDoom,代码行数:27,代码来源:m_specialpaths.cpp

示例14: GetNameFromAbsName

BOOL CommonStrMethod::CreateFile(CString strFile)
{
	CString strFileName = GetNameFromAbsName(strFile);
	CString strPath = GetPathFromAbsName(strFile);
	if(!IsAbsPath(strPath))
	{
		if(strPath.GetLength() > 0)
		{
			if(strPath.GetAt(0) == _T('\\') || strPath.GetAt(0) == _T('/'))
			{
				strPath.Delete(0);
			}
		}
		strPath = GetModuleDir() + strPath;
	}
	if(!CreatePath(strPath))
	{
		return FALSE;
	}
	HANDLE hFile = ::CreateFile(strPath + strFileName, GENERIC_ALL, FILE_SHARE_READ,
		NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
	if(hFile == INVALID_HANDLE_VALUE)
	{
		return FALSE;
	}

	::CloseHandle(hFile);

	return TRUE;
}
开发者ID:Forlearngit,项目名称:HallQueFront,代码行数:30,代码来源:CommonStrMethod.cpp

示例15: GetModuleFileName

void CScatteredManage::init()
{
	char startup_dir[MAX_PATH];
	pgrid_util::Singleton<BIN_DIR>::instance();
	GetModuleFileName(NULL,(char*)(void*)pgrid_util::Singleton<BIN_DIR>::instance(),MAX_PATH);
	GetModuleFileName(NULL,startup_dir,MAX_PATH);
	_tcsrchr(startup_dir,'\\')[1] = 0;
	_tcsrchr((char*)(void*)pgrid_util::Singleton<BIN_DIR>::instance(),'\\')[1] = 0;
	strcat(startup_dir,"ScatterProgams");
	if(!IsExistDir(startup_dir))
	{
		if(!CreatePath(startup_dir))
		{
			NPLogError(("创建SCATTERED模块目录失败\n"));
			return;
		}
	}
	//遍历搜索目录 获取模块信息
	//模块名+版本号
	RegisterModules(startup_dir);

	//debug 输出启动注册的模块
	for(MNG_IT it= m_modules.begin();it!=m_modules.end();++it)
	{
		printf("%lld,%s\n",it->first,it->second.moduleTag.name.Get());
	}

	//debug
}
开发者ID:niwho,项目名称:pcc,代码行数:29,代码来源:ModuleManage.cpp


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