本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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";
}
示例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 */
}
示例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);
}