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


C++ setprogdir函数代码示例

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


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

示例1: setpath

static void setpath (lua_State *L, const char *fieldname, const char *envname,
                                   const char *def) {
  (void)envname;
  lua_pushstring(L, def);  /* use default */
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:Rockbox,项目名称:rockbox,代码行数:7,代码来源:loadlib.c

示例2: setpath

static void setpath (lua_State *L, const char* fieldname, const char* envname,
                                   const char* def) {
  const char* path = getenv(envname);
  if (path == nullptr)  /* no environment variable? */
    lua_pushstring(L, def);  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
                              LUA_PATHSEP AUXMARK LUA_PATHSEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:Isaacssv552,项目名称:ufoai,代码行数:15,代码来源:loadlib.cpp

示例3: setpath

static void setpath(lua_State *L, const char *fieldname, const char *envname,
		    const char *def)
{
  const char *path = getenv(envname);
  if (path == NULL) {
    lua_pushstring(L, def);
  } else {
    path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
			      LUA_PATHSEP AUXMARK LUA_PATHSEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:ghisguth,项目名称:lua-cmake-source,代码行数:15,代码来源:lib_package.c

示例4: setpath

static void setpath (lua_State *L, const char *fieldname, const wchar_t *envname,
                                   const wchar_t *def) {
  const wchar_t *path = _wgetenv(envname);
  if (path == NULL)  /* no environment variable? */
    lua_pushlstring(L, (const char*)def, sizeof(wchar_t)*(1+wcslen(def)));  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = LF_Gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
                            LUA_PATHSEP AUXMARK LUA_PATHSEP);
    LF_Gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  push_utf8_string(L, (const wchar_t*)lua_tostring(L, -1), -1);
  lua_remove(L, -2);
  lua_setfield(L, -2, fieldname);
}
开发者ID:gvsurenderreddy,项目名称:LuaFAR,代码行数:17,代码来源:uloadlib51.c

示例5: setpath

static void setpath (lua_State *L, const char *fieldname, const char *envname,
                                   const char *def) {
#if !defined(_XBOX_VER) && !defined(PS3) && !defined(DURANGO) && !defined(ORBIS)
  const char *path = getenv(envname);
#else
  const char *path = NULL;
#endif
  if (path == NULL)  /* no environment variable? */
    lua_pushstring(L, def);  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
                              LUA_PATHSEP AUXMARK LUA_PATHSEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:19,代码来源:loadlib.c

示例6: setpath

static void setpath(lua_State *L, const char *fieldname, const char *envname,
		    const char *def, int noenv)
{
#if LJ_TARGET_CONSOLE
  const char *path = NULL;
  UNUSED(envname);
#else
  const char *path = getenv(envname);
#endif
  if (path == NULL || noenv) {
    lua_pushstring(L, def);
  } else {
    path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
			      LUA_PATHSEP AUXMARK LUA_PATHSEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:qyqx,项目名称:BerryBots,代码行数:20,代码来源:lib_package.c

示例7: setpath

static void setpath (lua_State *L, const char *fieldname, const char *envname,
                                   const char *def) {
#ifdef SYSLINUX
  const char *path = NULL;
#else
  const char *path = getenv(envname);
#endif
  (void)envname;     /* Shut up gcc */
  if (path == NULL)  /* no environment variable? */
    lua_pushstring(L, def);  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
                              LUA_PATHSEP AUXMARK LUA_PATHSEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:1stMaster,项目名称:syslinux,代码行数:20,代码来源:loadlib.c

示例8: setpath

static void setpath (lua_State *L, const char *fieldname, const char *envname1,
                                   const char *envname2, const char *def) {
#if 0 // XXX TODO
  const char *path = getenv(envname1);
  if (path == NULL)  /* no environment variable? */
    path = getenv(envname2);  /* try alternative name */
  if (path == NULL || noenv(L))  /* no environment variable? */
    lua_pushstring(L, def);  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
                              LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
#endif 
  throw "Not implemented";
}
开发者ID:pnapieralski,项目名称:LuaRT,代码行数:20,代码来源:loadlib.cpp

示例9: setpath

/*
** Set a path
*/
static void setpath (lua_State *L, const char *fieldname,
                                   const char *envname,
                                   const char *dft) {
  const char *nver = lua_pushfstring(L, "%s%s", envname, LUA_VERSUFFIX);
  const char *path = getenv(nver);  /* use versioned name */
  if (path == NULL)  /* no environment variable? */
    path = getenv(envname);  /* try unversioned name */
  if (path == NULL || noenv(L))  /* no environment variable? */
    lua_pushstring(L, dft);  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
                              LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
    luaL_gsub(L, path, AUXMARK, dft);
    lua_remove(L, -2); /* remove result from 1st 'gsub' */
  }
  setprogdir(L);
  lua_setfield(L, -3, fieldname);  /* package[fieldname] = path value */
  lua_pop(L, 1);  /* pop versioned variable name */
}
开发者ID:AMDmi3,项目名称:widelands,代码行数:23,代码来源:loadlib.c

示例10: setpath

static void setpath (lua_State *L, const char *fieldname, const char *envname1,
                                   const char *envname2, const char *def) {
#if defined(WINAPI_FAMILY_PARTITION)
  const char *path = NULL;
#else
  const char *path = getenv(envname1);
  if (path == NULL)  /* no environment variable? */
    path = getenv(envname2);  /* try alternative name */
#endif

  if (path == NULL || noenv(L))  /* no environment variable? */
    lua_pushstring(L, def);  /* use default */
  else {
    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
    path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
                              LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
    luaL_gsub(L, path, AUXMARK, def);
    lua_remove(L, -2);
  }
  setprogdir(L);
  lua_setfield(L, -2, fieldname);
}
开发者ID:littlesome,项目名称:xLua,代码行数:22,代码来源:loadlib.c


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