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

C++ ExpandPath函数代码示例

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

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



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


示例16: WriteFile

/*
===========
WriteFile

Save as a seperate file instead of as a wadfile lump
===========
*/
void WriteFile (void)
{
	char	filename[1024];
	char	*exp;

	sprintf (filename,"%s/%s.lmp", destfile, lumpname);
	exp = ExpandPath(filename);
	printf ("saved %s\n", exp);
	SaveFile (exp, lumpbuffer, lump_p-lumpbuffer);		
}
开发者ID:DeadlyGamer,项目名称:cs16nd,代码行数:17,代码来源:qlumpy.c


示例17: GetCreateProcessInfo

void GetCreateProcessInfo(LPVOID* p, LPTSTR* pApplicationName, LPTSTR* pCommandLine)
{
   LPTSTR ImageName = GetString(p);
   LPTSTR CmdLine = GetString(p);

   ExpandPath(pApplicationName, ImageName);

   LPTSTR ExpandedCommandLine;
   ExpandPath(&ExpandedCommandLine, CmdLine);

   LPTSTR MyCmdLine = GetCommandLine();
   LPTSTR MyArgs = SkipArg(MyCmdLine);
   
   *pCommandLine = LocalAlloc(LMEM_FIXED, lstrlen(ExpandedCommandLine) + sizeof(TCHAR) + lstrlen(MyArgs) + sizeof(TCHAR));
   lstrcpy(*pCommandLine, ExpandedCommandLine);
   lstrcat(*pCommandLine, _T(" "));
   lstrcat(*pCommandLine, MyArgs);
   
   LocalFree(ExpandedCommandLine);
}
开发者ID:Epictetus,项目名称:ocra,代码行数:20,代码来源:stub.c


示例18: LoadSeg

/*************
 * DESCRIPTION:   load texture
 * INPUT:         texture     texture
 * OUTPUT:        FALSE if failed else TRUE
 *************/
BOOL IPREVIEW_TEXTURE::Load(TEXTURE *texture)
{
	/* Load Imagine texture  */
#ifdef __AMIGA__
	IM_TTABLE* (*texture_init)(LONG arg0);

	seglist = LoadSeg(texture->name);
	if(!seglist)
		return FALSE;

	*(ULONG*)(&texture_init) = 4*seglist+4;
#ifdef __PPC__
	ttable = ITextureInit(texture_init);
#else
	ttable = texture_init(0x60FFFF);
#endif
#else
	INQUIRETEXTURE InquireTexture;
	PREFS prefs;
	char szBuffer[256];

	prefs.id = ID_TXTP;
	if (prefs.GetPrefs())
		ExpandPath((char *)prefs.data, texture->name, szBuffer);
	else
		strcpy(szBuffer, texture->name);

	prefs.data = NULL; // VERY important !

	hInst = LoadLibrary(szBuffer);
	if (!hInst)
		return FALSE;

	InquireTexture = (INQUIRETEXTURE)GetProcAddress(hInst, "InquireTexture");
	if (!InquireTexture)
		return FALSE;

	ttable = InquireTexture(0x70, 0x1);
#endif

	if(!ttable)
		return FALSE;

	// copy parameters
	memcpy(params, ((IMAGINE_TEXTURE*)texture)->params, 16*sizeof(float));

	form.pos = pos;
	form.orient_x = orient_x;
	form.orient_y = orient_y;
	form.orient_z = orient_z;
	form.size = size;

	return TRUE;
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:59,代码来源:Preview.cpp


示例19: EList

EDirectory::EDirectory(int createFlags, EModel **ARoot, char *aPath): EList(createFlags, ARoot, aPath) {
    char XPath[MAXPATH];

    Files = 0;
    FCount = 0;
    SearchLen = 0;
    ExpandPath(aPath, XPath, sizeof(XPath));
    Slash(XPath, 1);
    Path = strdup(XPath);
    RescanList();
}
开发者ID:lecheel,项目名称:fte-fork,代码行数:11,代码来源:o_directory.cpp


示例20: buffer

int CFolderItem::FolderCreateDirectory(int showFolder)
{
	if (m_tszFormat == NULL)
		return FOLDER_SUCCESS;

	CMString buffer(ExpandPath(m_tszFormat));
	CreateDirectoryTreeT(buffer);
	if (showFolder)
		ShellExecute(NULL, L"explore", buffer, NULL, NULL, SW_SHOW);

	return (DirectoryExists(buffer)) ? FOLDER_SUCCESS : FOLDER_FAILURE;
}
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:12,代码来源:folderItem.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Expect函数代码示例发布时间:2022-05-30
下一篇:
C++ ExpandEnvironmentStringsW函数代码示例发布时间: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