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


C++ DirectoryExists函数代码示例

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


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

示例1: ExpandFileName

//---------------------------------------------------------------------------
void __fastcall TChatRoomForm::ProxyButtonClick(TObject *Sender)
{

  TDSJavaScriptProxyWriter *JSProxy;
  String OutputFile;

  OutputFile = ExpandFileName(ServerContainerForm->ChatRoomFileDispatcher->RootDirectory);

  JSProxy = new TDSJavaScriptProxyWriter();

  try
  {
    if (!DirectoryExists(OutputFile))
      ForceDirectories(OutputFile);

    if ( !AnsiEndsStr("\\", OutputFile) &&
      !AnsiEndsStr("/", OutputFile))
      OutputFile = OutputFile + Sysutils::PathDelim;

    //put the proxy file in a subdirectory of the root folder
    OutputFile = OutputFile + Sysutils::PathDelim + "webfiles" + Sysutils::PathDelim;

    //name the proxy file
    OutputFile = OutputFile + "JSProxy.js";

    ProxyConnection->Connected = true;
    JSProxy->UpdateJSProxyFile(ProxyConnection->DBXConnection, OutputFile);
    ProxyConnection->Close();
  }
  __finally
  {
    JSProxy->Free();
  }
}
开发者ID:SkylineNando,项目名称:Delphi,代码行数:35,代码来源:ChatRoomServerUnit.cpp

示例2: SendMessage

//---------------------------------------------------------------------------
void __fastcall TfrmMain::FormCreate(TObject *Sender)
{
	cb_key1->Items->AddStrings(Keys);
	cb_key2->Items->AddStrings(Keys);
	cb_key3->Items->AddStrings(Keys);
	cb_key4->Items->AddStrings(Keys);
	cb_pick->Items->AddStrings(Keys);
    cb_att->Items->AddStrings(Keys);
	cb_key1->ItemIndex = 0;
	cb_key1->ItemIndex = 1;
	cb_key1->ItemIndex = 2;
	cb_key1->ItemIndex = 3;
	cb_pick->ItemIndex = 4;
	cb_att->ItemIndex = 5;
	UI->Enabled = true;
	SendMessage(FmxHandleToHWND(this->Handle), WM_SETICON, ICON_BIG, (LPARAM) hIcon1);
	SendMessage(FmxHandleToHWND(this->Handle), WM_SETICON, ICON_SMALL, (LPARAM) hIcon1);
	SendMessage(FmxHandleToHWND(this->Handle), WM_SETICON, ICON_SMALL2, (LPARAM) hIcon1);
	this->Caption = String("RwBox ++ - ") +  GameAccount;

	if( !DirectoryExists( String(LoginerPath) + "\\Data\\" + GameAccount))
	{
		CreateDir(String(LoginerPath) + "\\Data\\");
		CreateDir(String(LoginerPath) + "\\Data\\" + GameAccount + "\\");
	}
		Load->Enabled = true;
}
开发者ID:taida957789,项目名称:Deprecated-RwBox-Plus,代码行数:28,代码来源:FormMain.cpp

示例3: ListSources

void __fastcall TForm1::TBItem1Click(TObject *Sender)
{
 _di_IXMLNode ANode;
 AnsiString fname;

 ArticleList->Clear();

 if(XMLDoc->FileName == NULL) {
  Application->MessageBoxA("News Turkey can't get news unless a source to get news from is selected.", "News Turkey Error", NULL);
  return;
 }

 XMLDoc->Active = TRUE;

 if(XMLDoc->Active == FALSE) { //This is to predvent Access Violations if there is a problem parsing the file
  return;
 }

 ListSources();

 ANode = RSSChannel->ChildNodes->FindNode("title");

 if(DirectoryExists(ANode->Text) == FALSE) {
  CreateDir(ANode->Text);
 }

 XMLDoc->SaveToFile(fname.sprintf("CNET News.com - Front Door\\feed.xml"));

 XMLDoc->Active = FALSE;        
}
开发者ID:BackupTheBerlios,项目名称:newsturkey,代码行数:30,代码来源:Unit1.cpp

示例4: GetMatlab6Root

//---------------------------------------------------------------------------
AnsiString __fastcall GetMatlab6Root(void)
{
   AnsiString S = "";
   __TRY
   TRegistry *RR = new TRegistry();
   try
    {
    // Для Matlab 6.5

     RR->RootKey = HKEY_CLASSES_ROOT;
     if (RR->OpenKey("\\Matlab.Application.Single.6\\CLSID",false))
       S = RR->ReadString("");
     if (RR->OpenKey("\\CLSID\\"+S+"\\LocalServer32",false))
       S = RR->ReadString("");
     int ps = S.AnsiPos("matlab.exe");
     if (ps) {
      S = S.SubString( 1, ps-2);
     // S содержит размещение matlab.exe (полный путь)
      S = ExtractFileDir(S);
      S = ExtractFileDir(S);
      }
    }
      __finally {
      delete RR;
      }
  if (!DirectoryExists(S)) {
    S = "";
    }
  __CATCH
  return S;
}
开发者ID:GraffLittle,项目名称:first,代码行数:32,代码来源:Commons.cpp

示例5: FRecurse

bool IPlatformFile::DeleteDirectoryRecursively(const TCHAR* Directory)
{
	class FRecurse : public FDirectoryVisitor
	{
	public:
		IPlatformFile&		PlatformFile;
		FRecurse(IPlatformFile&	InPlatformFile)
			: PlatformFile(InPlatformFile)
		{
		}
		virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory)
		{
			if (bIsDirectory)
			{
				PlatformFile.IterateDirectory(FilenameOrDirectory, *this);
				PlatformFile.DeleteDirectory(FilenameOrDirectory);
			}
			else
			{
				PlatformFile.SetReadOnly(FilenameOrDirectory, false);
				PlatformFile.DeleteFile(FilenameOrDirectory);
			}
			return true; // continue searching
		}
	};
	FRecurse Recurse(*this);
	Recurse.Visit(Directory, true);
	return !DirectoryExists(Directory);
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:29,代码来源:GenericPlatformFile.cpp

示例6: exit

void Runtime::Debugger::Debug() {
  wcout << L"-------------------------------------" << endl;
  wcout << L"Objeck " << VERSION_STRING << L" - Interactive Debugger" << endl;
  wcout << L"-------------------------------------" << endl << endl;

  if(FileExists(program_file, true) && DirectoryExists(base_path)) {
    wcout << L"loaded executable: file='" << program_file << L"'" << endl;
    wcout << L"source files: path='" << base_path << L"'" << endl << endl;
    // clear arguments
    arguments.clear();
    arguments.push_back(L"obr");
    arguments.push_back(program_file);
  }
  else {
    wcerr << L"unable to load executable or locate base path." << endl;
    exit(1);
  }

  // enter feedback loop
  ClearProgram();
  wcout << L"> ";
  while(true) {    
    wstring line;
    getline(wcin, line);
    if(line.size() > 0) {
      ProcessCommand(line);
      wcout << L"> ";
    }
  }
}
开发者ID:8l,项目名称:objeck-lang,代码行数:30,代码来源:debugger.cpp

示例7: path

void ComposerShellMenu::SetStatus()
{
    m_Status.invalid = false;

    // See if we are in vendor directory
    std::wstring path(m_TargetDir + L"\\");
    size_t pos = path.rfind(L"\\vendor\\");
    if (std::wstring::npos != pos)
    {
        path.resize(pos);
        m_Status.invalid = DirectoryExists(path + L"\\vendor\\composer");
    }
    
    if (m_Status.invalid)
        return;
        
    m_Status.composer = FileExists(m_TargetDir + L"\\composer.json");

    if (m_Status.composer)
    {
        // We have a composer.json. Check if we have installed it
        m_Status.installed = FileExists(m_TargetDir + L"\\vendor\\composer\\installed.json");
        
        /*
        //std::wstring composerJson = ReadComposerJson();
        m_Status.project = std::wstring::npos == composerJson.find(L"\"name\":");
        m_Status.package = !m_Status.project;
        */
    }
}
开发者ID:AlexRee,项目名称:windows-setup,代码行数:30,代码来源:menu.cpp

示例8: IsSvnDir2

bool IsSvnDir2(const String& p)
{ // this is a cope of usvn/IsSvnDir to avoid modular issues
	if(IsNull(p))
		return false;
	if(DirectoryExists(AppendFileName(p, ".svn")) || DirectoryExists(AppendFileName(p, "_svn")))
		return true;
	String path = p;
	String path0;
	while(path != path0) {
		path0 = path;
		path = GetFileFolder(path);
		if(DirectoryExists(AppendFileName(path, ".svn")))
			return true;
	}
	return false;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:16,代码来源:CppBuilder.cpp

示例9: worker_fetch_partition_file

/*
 * worker_fetch_partition_file fetches a partition file from the remote node.
 * The function assumes an upstream compute task depends on this partition file,
 * and therefore directly fetches the file into the upstream task's directory.
 */
Datum
worker_fetch_partition_file(PG_FUNCTION_ARGS)
{
	uint64 jobId = PG_GETARG_INT64(0);
	uint32 partitionTaskId = PG_GETARG_UINT32(1);
	uint32 partitionFileId = PG_GETARG_UINT32(2);
	uint32 upstreamTaskId = PG_GETARG_UINT32(3);
	text *nodeNameText = PG_GETARG_TEXT_P(4);
	uint32 nodePort = PG_GETARG_UINT32(5);
	char *nodeName = NULL;

	/* remote filename is <jobId>/<partitionTaskId>/<partitionFileId> */
	StringInfo remoteDirectoryName = TaskDirectoryName(jobId, partitionTaskId);
	StringInfo remoteFilename = PartitionFilename(remoteDirectoryName, partitionFileId);

	/* local filename is <jobId>/<upstreamTaskId>/<partitionTaskId> */
	StringInfo taskDirectoryName = TaskDirectoryName(jobId, upstreamTaskId);
	StringInfo taskFilename = TaskFilename(taskDirectoryName, partitionTaskId);

	/*
	 * If we are the first function to fetch a file for the upstream task, the
	 * task directory does not exist. We then lock and create the directory.
	 */
	bool taskDirectoryExists = DirectoryExists(taskDirectoryName);
	if (!taskDirectoryExists)
	{
		InitTaskDirectory(jobId, upstreamTaskId);
	}

	nodeName = text_to_cstring(nodeNameText);
	FetchRegularFile(nodeName, nodePort, remoteFilename, taskFilename);

	PG_RETURN_VOID();
}
开发者ID:amosbird,项目名称:citus,代码行数:39,代码来源:worker_data_fetch_protocol.c

示例10: DirectoryExists

// Check if the specified directory exists
bool MassStorage::DirectoryExists(const char *path) const
{
	// Remove any trailing '/' from the directory name, it sometimes (but not always) confuses f_opendir
	String<MaxFilenameLength> loc;
	loc.copy(path);
	return DirectoryExists(loc.GetRef());
}
开发者ID:dc42,项目名称:RepRapFirmware,代码行数:8,代码来源:MassStorage.cpp

示例11: PathConform

SString SharedUtil::MakeUniquePath(const SString& strInPathFilename)
{
    const SString strPathFilename = PathConform(strInPathFilename);

    SString strBeforeUniqueChar, strAfterUniqueChar;

    SString strPath, strFilename;
    ExtractFilename(strPathFilename, &strPath, &strFilename);

    SString strMain, strExt;
    if (ExtractExtension(strFilename, &strMain, &strExt))
    {
        strBeforeUniqueChar = PathJoin(strPath, strMain);
        strAfterUniqueChar = "." + strExt;
    }
    else
    {
        strBeforeUniqueChar = strPathFilename;
        strAfterUniqueChar = "";
    }

    SString strTest = strPathFilename;
    int     iCount = 1;
#ifdef WIN32
    while (GetFileAttributes(strTest) != INVALID_FILE_ATTRIBUTES)
#else
    while (DirectoryExists(strTest) || FileExists(strTest))
#endif
    {
        strTest = SString("%s_%d%s", strBeforeUniqueChar.c_str(), iCount++, strAfterUniqueChar.c_str());
    }
    return strTest;
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:33,代码来源:SharedUtil.File.hpp

示例12: TForm

//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
__fastcall TDialogProjectNew::TDialogProjectNew(TComponent* Owner)
  : TForm(Owner)
{
  TemplatePath = Usul()->Ini->ReadString("Settings", "PathTemplatesProjects", TemplatePath = Usul()->Path + "\\Templates\\Projects");
  PageControl->ActivePageIndex = 0;
  TSearchRec SearchRec;
  if (FindFirst(TemplatePath + "\\*", faDirectory, SearchRec) == 0) {
    do {
      if (SearchRec.Name[1] != '.') {
        TListItem *ListItem = ListView->Items->Add();
        ListItem->Caption = SearchRec.Name;
        ListItem->ImageIndex = 1;
      }
    } while (FindNext(SearchRec) == 0);
  }
  FindClose(SearchRec);

  if (Usul()->HasWriteAccessToExeDirectrory())
    Edit->Text = Usul()->Path + "\\New project";
  else
    Edit->Text = Usul()->PathDocuments + "\\New project";
  for (int I = 2;;I++) {
    bool IsDirectoryExists = DirectoryExists(Edit->Text);
    bool IsFileExists = FileExists(Edit->Text);
    if (!IsDirectoryExists && !IsFileExists) break;
    Edit->Text = Usul()->Path + "\\New project" + String(I);
  }
}
开发者ID:NogsIoT,项目名称:Nogs-IDE,代码行数:31,代码来源:ProjectNewDlg.cpp

示例13: while

void TProfileToGui::_removeNonExistentDirsFromList(std::vector<String> &list)
{
	unsigned int i = 0;
	while (i < list.size())
	{
		if (!DirectoryExists(list[i]))
		{
			f_Main->statusNotif( ASPF(_("Directory does not exist: %s"),
                ecc::QuoteStr(list[i])) + " - ");
                ++i;
 			if (PGlobals->RemoveNonExistingSourceDirs)
			{
				std::vector<String>::iterator pos = &list[i];
				list.erase(pos);
				f_Main->statusNotif( _("Removed from Profile."), -1);
			}
			else
			{
				f_Main->statusNotif( _("Ok."), -1);
				++i;
			}
		}
		else ++i;
	}
}
开发者ID:ChakaZulu,项目名称:abakt,代码行数:25,代码来源:Gui_X_Profile.cpp

示例14: populate_dir

void populate_dir (void)
{
  char buf[MAX_PATH];
  char mask[MAX_MASK_LEN];
  GetWindowText(GetDlgItem(hMainWindow, IDC_MANPATH), buf, sizeof(buf));
  GetWindowText(GetDlgItem(hMainWindow, IDC_MASK), mask, sizeof(mask));
  if (!DirectoryExists(buf))  {
    current_path_to_edit ();
    strcpy (buf, CurrentPath);
  }
  else  {
    size_t off;
    off = strlen(buf);
    if ((off) && (buf[off-1] != '\\') && (buf[off-1] != '/')) {
      buf[off] = '\\';
      buf[off+1] = 0;
    }
    strcpy (CurrentPath, buf);
    current_path_to_edit ();
  }
  DlgDirListComboBox(hMainWindow, buf, IDC_DRIVES, 0, DDL_DRIVES);
  DlgDirList (hMainWindow, buf, IDC_DIRS, 0, DDL_DIRECTORY + DDL_EXCLUSIVE);
  /* if you want to show only files that match mask - uncomment next line */
  //strcat (buf, mask);
  DlgDirList (hMainWindow, buf, IDC_FILES, IDC_REALPATH, 0x27);

  snprintf (mask, sizeof(mask), "[-%c-]", 'a' +_getdrive() - 1);
  ComboBox_SelectString (GetDlgItem(hMainWindow, IDC_DRIVES), 0, mask);
}
开发者ID:goriy,项目名称:sif,代码行数:29,代码来源:swnd.c

示例15: GetDlgItemTextA

void ProjectConfigDialog::onSelectScriptFile(void)
{
    char buff[MAX_PATH + 1] = {0};
    char projdir[MAX_PATH + 1] = {0};
    GetDlgItemTextA(m_hwndDialog, IDC_EDIT_PROJECT_DIR, projdir, MAX_PATH);

    OPENFILENAMEA ofn = {0};
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = m_hwndDialog;
    ofn.lpstrFilter = "Lua Script File (*.lua)\0*.lua\0";
    ofn.lpstrTitle = "Select Script File";
    if (DirectoryExists(projdir))
    {
        ofn.lpstrInitialDir = projdir;
    }
    ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
    ofn.lpstrFile = buff;
    ofn.nMaxFile = MAX_PATH;

    if (GetOpenFileNameA(&ofn))
    {
        m_project.setScriptFile(buff);
        updateScriptFile();
    }
}
开发者ID:AlexYanJianhua,项目名称:quick-cocos2d-x,代码行数:25,代码来源:ProjectConfigDialog.cpp


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