當前位置: 首頁>>代碼示例>>C++>>正文


C++ ExpandPath函數代碼示例

本文整理匯總了C++中ExpandPath函數的典型用法代碼示例。如果您正苦於以下問題:C++ ExpandPath函數的具體用法?C++ ExpandPath怎麽用?C++ ExpandPath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ExpandPath函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: autosprintf

bool cTriggerConsole::CheckData(cfBase *cmd, cTrigger &data)
{
	if(data.mDefinition.empty()) {
		*cmd->mOS << _("The definition is empty or not specified. Please define it with -d option.");
		return false;
	}
	size_t pos = data.mDefinition.rfind("dbconfig");
	if(pos != string::npos) {
		*cmd->mOS << _("It's not allowed to define dbconfig file as trigger.") << "\n";
		cConnDC *conn = (cConnDC *) cmd->mConn;
		ostringstream message;
		message << autosprintf(_("User '%s' tried to define dbconfig as trigger"), conn->mpUser->mNick.c_str());
		mOwner->mServer->ReportUserToOpchat(conn, message.str());
		return false;
	}
	FilterPath(data.mDefinition);
	string vPath(mOwner->mServer->mConfigBaseDir), triggerPath, triggerName;
	ExpandPath(vPath);
	GetPath(data.mDefinition, triggerPath, triggerName);
	ReplaceVarInString(triggerPath, "CFG", triggerPath, vPath);
	ExpandPath(triggerPath);

	if ((triggerPath.substr(0, vPath.length()) != vPath)) {
		(*cmd->mOS) << autosprintf(_("The file %s for the trigger %s must be located in %s configuration folder, use %%[CFG] variable, for example: %%[CFG]/%s"), data.mDefinition.c_str(), data.mCommand.c_str(), HUB_VERSION_NAME, triggerName.c_str());
		return false;
	}

	return true;
}
開發者ID:Eco-logical,項目名稱:verlihub,代碼行數:29,代碼來源:ctriggers.cpp

示例2: Allocate

/** Get tokens from a menu include (either dynamic or static). */
TokenNode *ParseMenuIncludeHelper(const TokenNode *tp, const char *command)
{
   FILE *fd;
   char *path;
   char *buffer;
   TokenNode *start;

   buffer = NULL;
   if(!strncmp(command, "exec:", 5)) {

      path = Allocate(strlen(command) - 5 + 1);
      strcpy(path, command + 5);
      ExpandPath(&path);

      fd = popen(path, "r");
      if(JLIKELY(fd)) {
         buffer = ReadFile(fd);
         pclose(fd);
      } else {
         ParseError(tp, "could not execute included program: %s", path);
      }

   } else {

      path = CopyString(command);
      ExpandPath(&path);

      fd = fopen(path, "r");
      if(JLIKELY(fd)) {
         buffer = ReadFile(fd);
         fclose(fd);
      } else {
         ParseError(NULL, "could not open include: %s", path);
      }

   }

   if(JUNLIKELY(!buffer)) {
      Release(path);
      return NULL;
   }

   start = Tokenize(buffer, path);
   Release(buffer);
   Release(path);

   if(JUNLIKELY(!start || start->type != TOK_JWM))
   {
      ParseError(tp, "invalid include: %s", command);
      ReleaseTokens(start);
      return NULL;
   }

   return start;
}
開發者ID:Nehamkin,項目名稱:jwm,代碼行數:56,代碼來源:parse.c

示例3: ExpandPathW

int CFolderItem::FolderCreateDirectory(int showFolder)
{
	int res = FOLDER_SUCCESS;
	if (IsUnicode())
		{
			wchar_t buffer[MAX_FOLDER_SIZE];
			if (szFormatW)
				{
					ExpandPathW(buffer, szFormatW, MAX_FOLDER_SIZE);
					CreateDirectories(buffer);
					if (showFolder)
						{
							ShellExecuteW(NULL, L"explore", buffer, NULL, NULL, SW_SHOW);
						}
					res = (DirectoryExists(buffer)) ? FOLDER_SUCCESS : FOLDER_FAILURE;
				}
		}
		else{
			char buffer[MAX_FOLDER_SIZE];
			if (szFormat)
				{
					ExpandPath(buffer, szFormat, MAX_FOLDER_SIZE);
					CreateDirectories(buffer);
					if (showFolder)
						{
							ShellExecuteA(NULL, "explore", buffer, NULL, NULL, SW_SHOW);
						}
					res = (DirectoryExists(buffer)) ? FOLDER_SUCCESS : FOLDER_FAILURE;
				}
		}
	return res;
}
開發者ID:TonyAlloa,項目名稱:miranda-dev,代碼行數:32,代碼來源:folderItem.cpp

示例4: cd_cmd

/**
 *	@public
 *	@brief	Changes the Current Working Directory
 *
 *	To change the directory, we simply check the provided path, if it exists,
 *	then we change the environment's working directory to that path.
 *
 **/
int cd_cmd(int argc, char **argv, FF_ENVIRONMENT *pEnv) {
	FF_IOMAN *pIoman = pEnv->pIoman;
	FF_T_INT8	path[FF_MAX_PATH];

	int i;

	if(argc == 2) {
		ProcessPath(path, argv[1], pEnv);	// Make path absolute if relative.

		ExpandPath(path);	// Remove any relativity from the path (../ or ..\).
		
		if(FF_FindDir(pIoman, path, (FF_T_UINT16) strlen(path))) {	// Check if path is valid.
			i = strlen(path) - 1;	// Path found, change the directory.

			if(i) {
				if(path[i] == '\\' || path[i] == '/') {
					path[i] = '\0';
				}
			}
			strcpy(pEnv->WorkingDir, path);
			//sprintf(pEnv->WorkingDir, path);
		} else {
			cons_printf("Path \"%s\" not found.\n", path);
		}
	} else {
		cons_printf("Usage: %s [path]\n", argv[0]);
	}
	return 0;
}
開發者ID:bicepjai,項目名稱:nanos,代碼行數:37,代碼來源:ff_cmd.c

示例5: ParseInclude

/** Parse an include. */
void ParseInclude(const TokenNode *tp, int depth) {

   char *temp;

   Assert(tp);

   if(JUNLIKELY(!tp->value)) {

      ParseError(tp, "no include file specified");

   } else {

      temp = CopyString(tp->value);

      ExpandPath(&temp);

      if(JUNLIKELY(!ParseFile(temp, depth))) {
         ParseError(tp, "could not open included file %s", temp);
      }

      Release(temp);

   }

}
開發者ID:Nehamkin,項目名稱:jwm,代碼行數:26,代碼來源:parse.c

示例6: OpenDir

int EView::OpenDir(char *Path) {
    char XPath[MAXPATH];
    EDirectory *dir = 0;

    if (ExpandPath(Path, XPath, sizeof(XPath)) == -1)
        return 0;
    {
        EModel *x = Model;
        while (x) {
            if (x->GetContext() == CONTEXT_DIRECTORY) {
                if (filecmp(((EDirectory *)x)->Path, XPath) == 0) {
                    dir = (EDirectory *)x;
                    break;
                }
            }
            x = x->Next;
            if (x == Model)
                break;
        }
    }
    if (dir == 0)
        dir = new EDirectory(0, &ActiveModel, XPath);
    SelectModel(dir);
    return 1;
}
開發者ID:mongrelx,項目名稱:efte,代碼行數:25,代碼來源:view.cpp

示例7: TEST

static	void
TEST(
	char	*orig,
	char	*base)
{
	printf("[%s] = [%s]\n",orig,ExpandPath(orig,base));
}
開發者ID:ogochan,項目名稱:libmondai,代碼行數:7,代碼來源:testothers.c

示例8: RefreshPreview

static void RefreshPreview(HWND hWnd)
{
	TCHAR tmp[MAX_FOLDER_SIZE], res[MAX_FOLDER_SIZE];
	GetEditText(hWnd, tmp, MAX_FOLDER_SIZE);
	ExpandPath(res, tmp, MAX_FOLDER_SIZE);
	SetWindowText(GetDlgItem(hWnd, IDC_PREVIEW_EDIT), res);
}
開發者ID:0xmono,項目名稱:miranda-ng,代碼行數:7,代碼來源:dlg_handlers.cpp

示例9: AddScriptToStack

/*
==============
AddScriptToStack
==============
*/
void AddScriptToStack (char *filename, ScriptPathMode_t pathMode = SCRIPT_USE_ABSOLUTE_PATH)
{
	int            size;

	script++;
	if (script == &scriptstack[MAX_INCLUDES])
		Error ("script file exceeded MAX_INCLUDES");
	
	if ( pathMode == SCRIPT_USE_RELATIVE_PATH )
		Q_strncpy( script->filename, filename, sizeof( script->filename ) );
	else
		Q_strncpy (script->filename, ExpandPath (filename), sizeof( script->filename ) );

	size = LoadFile (script->filename, (void **)&script->buffer);

	// printf ("entering %s\n", script->filename);
	if ( g_pfnCallback )
	{
		if ( script == scriptstack + 1 )
			g_pfnCallback( script->filename, NULL, 0 );
		else
			g_pfnCallback( script->filename, script[-1].filename, script[-1].line );
	}

	script->line = 1;

	script->script_p = script->buffer;
	script->end_p = script->buffer + size;
}
開發者ID:Baer42,項目名稱:source-sdk-2013,代碼行數:34,代碼來源:scriplib.cpp

示例10: strcpy

int EDirectory::FmMkDir() {
    char Dir[MAXPATH];
    char Dir2[MAXPATH];

    strcpy(Dir, Path);
    if (View->MView->Win->GetStr("New directory name", sizeof(Dir), Dir, HIST_PATH) == 0) {
        return 0;
    }

    if (ExpandPath(Dir, Dir2, sizeof(Dir2)) == -1) {
        Msg(S_INFO, "Failed to create directory, path did not expand");
        return 0;
    }

#if defined(MSVC) || defined(BCPP) || defined(WATCOM) || defined(__WATCOM_CPLUSPLUS__)
    int status = mkdir(Dir2);
#else
    int status = mkdir(Dir2, 509);
#endif
    if (status == 0) {
        return RescanDir();
    }

    Msg(S_INFO, "Failed to create directory %s", Dir2);
    return 0;
}
開發者ID:mongrelx,項目名稱:efte,代碼行數:26,代碼來源:o_directory.cpp

示例11: ExpandPath

void
VisItDataServerPrivate::OpenDatabase(const std::string &filename, int timeState)
{
    // Determine the file and file format.
    if(openFile.empty())
    {
        // Expand the filename.
        std::string expandedFile = ExpandPath(filename);

        // Determine the file format.
        const avtDatabaseMetaData *md = mdserver.GetMDServerMethods()->GetMetaData(expandedFile);
        if(md == NULL)
        {
            EXCEPTION1(VisItException, "Can't get the metadata.");
        }
        openFile = expandedFile;
        openFileFormat = md->GetFileFormat();
    }
    openTimeState = timeState;

    // Set some default arguments.
    bool createMeshQualityExpressions = false;
    bool createTimeDerivativeExpressions = false;
    bool ignoreExtents = true;

    //
    // Open the database on the engine.
    //
    engine.GetEngineMethods()->OpenDatabase(openFileFormat,
                        openFile,
                        openTimeState,
                        createMeshQualityExpressions,
                        createTimeDerivativeExpressions,
                        ignoreExtents);
}
開發者ID:ahota,項目名稱:visit_intel,代碼行數:35,代碼來源:VisItDataServer.cpp

示例12: LCMTest_ExpandPath

MI_Result NITS_CALL LCMTest_ExpandPath(_In_z_ const MI_Char * pathIn,
                     _Outptr_result_maybenull_z_ MI_Char **expandedPath, 
                     _Outptr_result_maybenull_ MI_Instance **cimErrorDetails)
{
    return ExpandPath( pathIn, expandedPath, cimErrorDetails);

}
開發者ID:40a,項目名稱:WPSDSCLinux,代碼行數:7,代碼來源:lcm.traps.c

示例13: AddScriptToStack

/*
==============
AddScriptToStack
==============
*/
void AddScriptToStack (const char *filename, int index)
{
  int size;

  script++;
  if (script == &scriptstack[MAX_INCLUDES])
    Error ("script file exceeded MAX_INCLUDES");
  strcpy (script->filename, ExpandPath (filename));

  size = vfsLoadFile (script->filename, (void **)&script->buffer, index);

  if (size == -1)
    Sys_Printf ("Script file %s was not found\n", script->filename);
  else
  {
    if (index > 0)
      Sys_Printf ("entering %s (%d)\n", script->filename, index+1);
    else
      Sys_Printf ("entering %s\n", script->filename);
  }

  script->line = 1;
  script->script_p = script->buffer;
  script->end_p = script->buffer + size;
}
開發者ID:clbr,項目名稱:netradiant,代碼行數:30,代碼來源:scriplib.c

示例14: ExpandPath

int FTPCache::AddPathMap(PathMap pathmap) {
	TCHAR * expPath = ExpandPath(pathmap.localpath);
	if (expPath != NULL) {
		pathmap.localpathExpanded = expPath;
	}
	m_vCachePaths.push_back(pathmap);
	return 0;
}
開發者ID:Praymundo,項目名稱:NppFTP,代碼行數:8,代碼來源:FTPCache.cpp

示例15: ExpandDir

void wxGenericDirCtrl::ExpandRoot()
{
    ExpandDir(m_rootId); // automatically expand first level

    // Expand and select the default path
    if (!m_defaultPath.empty())
    {
        ExpandPath(m_defaultPath);
    }
#ifdef __UNIX__
    else
    {
        // On Unix, there's only one node under the (hidden) root node. It
        // represents the / path, so the user would always have to expand it;
        // let's do it ourselves
        ExpandPath( wxT("/") );
    }
#endif
}
開發者ID:drvo,項目名稱:wxWidgets,代碼行數:19,代碼來源:dirctrlg.cpp


注:本文中的ExpandPath函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。