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

C++ check_path函数代码示例

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

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



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

示例1: OPT_GET

void Thesaurus::OnLanguageChanged() {
	impl.reset();

	auto language = OPT_GET("Tool/Thesaurus/Language")->GetString();
	if (language.empty()) return;

	agi::fs::path idx, dat;

	auto path = config::path->Decode(OPT_GET("Path/Dictionary")->GetString() + "/");
	if (!check_path(path, language, idx, dat)) {
		path = config::path->Decode("?data/dictionaries/");
		if (!check_path(path, language, idx, dat))
			return;
	}

	LOG_I("thesaurus/file") << "Using thesaurus: " << dat;

	agi::dispatch::Background().Async([=]{
		try {
			auto thes = agi::util::make_unique<agi::Thesaurus>(dat, idx);
			agi::dispatch::Main().Sync([&]{
				impl = std::move(thes);
			});
		}
		catch (agi::Exception const& e) {
			LOG_E("thesaurus") << e.GetChainedMessage();
		}
	});
}
开发者ID:Leinad4Mind,项目名称:Aegisub,代码行数:29,代码来源:thesaurus.cpp


示例2: ff_get_ldnumber

// "path" is the path to lookup; will advance this pointer beyond the volume name.
// Returns logical drive number (-1 means invalid path).
int ff_get_ldnumber (const TCHAR **path) {
    if (!(*path)) {
        return -1;
    }

    if (**path != '/') {
    #if _FS_RPATH
        return ff_CurrVol;
    #else
        return -1;
    #endif
    }

    if (check_path(path, "/flash", 6)) {
        return PD_FLASH;
    }
    else {
        for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
            os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
            if (check_path(path, mount_obj->path, mount_obj->pathlen)) {
                return mount_obj->vol;
            }
        }
    }

    return -1;
}
开发者ID:19emtuck,项目名称:micropython,代码行数:29,代码来源:ffconf.c


示例3: ft_cd

void			ft_cd(char *buf, t_params *p)
{
	char	**av;
	char	*new_dir;
	int		ret;
	int		size;

	ret = 0;
	av = ft_split(buf);
	new_dir = NULL;
	size = av_size(av);
	if (size > 2)
		ft_putendl("cd: syntax error");
	else if (size == 1 || (size == 2 && !ft_strcmp(av[1], "~")))
		new_dir = ft_strdup(p->home);
	else
		new_dir = get_newdir(p, av[1]);
	if (new_dir && !(ret = check_path(new_dir)) && !chdir(new_dir))
		update_env(p, new_dir);
	else if (new_dir && !(ret = check_path(new_dir)) && chdir(new_dir) == -1)
		ft_print_error("cd: not a directory: ", av[1]);
	if (new_dir && ret && av[1])
		improper_path(ret, av[1]);
	ft_strdel(&new_dir);
	del_av(av);
}
开发者ID:mzane42,项目名称:ft_sh1,代码行数:26,代码来源:ft_cd.c


示例4: re

void
Util::detectCclive(
    QString& path,
    QString& version,
    QString& libVersion,
    QString& libName,
    bool *isCcliveFlag)
{

    const QStringList env =
        QProcess::systemEnvironment();

    QRegExp re("^PATH=(.*)", Qt::CaseInsensitive);
    env.indexOf(re);

    const QString capt = re.capturedTexts()[1].simplified();
    QStringList paths  = capt.split(":");

    if (paths.size() < 2) // w32
        paths = capt.split(";");

    if (paths.size() < 2)
        return;

    path = check_path(paths, "cclive");
    if (path.isEmpty())
        path = check_path(paths, "clive");

    if (path.isEmpty()) {
        // Detection from $PATH failed. Prompt user
        // to specify the path in preferences manually.
        throw NoCcliveException(
            QObject::tr(
                "Neither cclive or clive not was found in the path.\n"
                "Please specify the path to either command in the\n"
                "preferences."
            )
        );
    }
    else {
        // Check --version output.
        verify_version_output(
            path,
            version,
            libVersion,
            libName,
            isCcliveFlag
        );
    }
}
开发者ID:mogaal,项目名称:abby,代码行数:50,代码来源:util.cpp


示例5: dstr_init

/* on windows, data files should always be in [base directory]/data */
char *obs_find_plugin_file(const char *file)
{
	struct dstr path;
	dstr_init(&path);

	if (check_path(file, "data/obs-plugins/", &path))
		return path.array;

	if (check_path(file, "../../data/obs-plugins/", &path))
		return path.array;

	dstr_free(&path);
	return NULL;
}
开发者ID:Arkkis,项目名称:obs-studio,代码行数:15,代码来源:obs-windows.c


示例6: main

int main(int argc, char *argv[])
{
	void *fdt;

	test_init(argc, argv);
	fdt = load_blob_arg(argc, argv);

	check_path(fdt, "/");
	check_path(fdt, "/[email protected]");
	check_path(fdt, "/[email protected]");
	check_path(fdt, "/[email protected]/subsubnode");
	check_path(fdt, "/[email protected]/[email protected]");

	PASS();
}
开发者ID:ActionAdam,项目名称:osmc,代码行数:15,代码来源:get_path.c


示例7: compact

static void compact(char *bundle) {
	check_path(bundle, "token");
	check_path(bundle, "Info.plist");
	
	check_path(bundle, "bands");
	char *bands = strdup(buf);
	DIR *dir = opendir(bands);
	if (!dir)
		die("Can't open band dir");
	struct dirent *de;
	while ((de = readdir(dir))) {
		if (de->d_name[0] == '.')
			continue;
		
		fprintf(stdout, "%5s   ", de->d_name);
		if (snprintf(buf, PATH_MAX, "%s/%s", bands, de->d_name) >= PATH_MAX)
			die("Paths too long");
		int fd = open(buf, O_RDWR);
		if (!fd)
			die("Can't open band");
		ssize_t size = lseek(fd, 0, SEEK_END);
		if (size == -1)
			die("Can't seek");
		char *bytes = mmap(NULL, size, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
		if (bytes == MAP_FAILED)
			die("Can't mmap");
		
		size_t nz = size;
		for (; nz > 0 && !bytes[nz - 1]; --nz)
			;
		munmap(bytes, size);
		
		if (nz > 0 && nz < size) {
			fprintf(stdout, "saving %ld", size - nz);
			if (ftruncate(fd, nz) != 0)
				die("Can't truncate");
		}
		close(fd);
		if (nz == 0) {
			fprintf(stdout, "removing");
			if (unlink(buf) != 0)
				die("Can't unlink");
		}
		fprintf(stdout, "\n");
	}
	free(bands);
	closedir(dir);
}
开发者ID:vasi,项目名称:rhfs,代码行数:48,代码来源:sparsebundle-compact.c


示例8: check_path_from_xpath

int check_path_from_xpath(xmlXPathContextPtr xpath_ctx, const char *log_string, const xmlChar *path_xexpr) {
	int status = 0;
	xmlXPathObjectPtr xpath_obj;
	char* temp_char = NULL;

	xpath_obj = xmlXPathEvalExpression(path_xexpr, xpath_ctx);
	if(xpath_obj == NULL) {
		dual_log("ERROR: unable to evaluate xpath expression: %s", path_xexpr);
		return 1;
	}
    if (xpath_obj->nodesetval != NULL && xpath_obj->nodesetval->nodeNr > 0) {
		temp_char = (char*) xmlXPathCastToString(xpath_obj);

		status = check_path(temp_char, log_string);

        StrFree(temp_char);
	} else {
		/* Not set; return -1 so that we can test the default path */
		xmlXPathFreeObject(xpath_obj);
		return -1;
	}

    xmlXPathFreeObject(xpath_obj);
	return status;
}
开发者ID:matje,项目名称:ttods,代码行数:25,代码来源:kc_helper.c


示例9: mu_index_stats

MuError
mu_index_stats (MuIndex *index, const char *path,
		MuIndexStats *stats, MuIndexMsgCallback cb_msg,
		MuIndexDirCallback cb_dir, void *user_data)
{
	MuIndexCallbackData cb_data;

	g_return_val_if_fail (index, MU_ERROR);
	g_return_val_if_fail (cb_msg, MU_ERROR);

	if (!check_path (path))
		return MU_ERROR;

	if (stats)
		memset (stats, 0, sizeof(MuIndexStats));

	cb_data._idx_msg_cb        = cb_msg;
	cb_data._idx_dir_cb        = cb_dir;

	cb_data._stats     = stats;
	cb_data._user_data = user_data;

	cb_data._dirstamp  = 0;

	return mu_maildir_walk (path,
				(MuMaildirWalkMsgCallback)on_stats_maildir_file,
				NULL, FALSE, &cb_data);
}
开发者ID:Dabg,项目名称:mu,代码行数:28,代码来源:mu-index.c


示例10: global_physics_sweep_col_mesh

static int global_physics_sweep_col_mesh (lua_State *L)
{
TRY_START
        int base_line = 7;
        check_args_min(L, base_line);

        std::string col_mesh_name = check_path(L, 1);
        DiskResource *col_mesh_ = disk_resource_get_or_make(col_mesh_name);
        CollisionMesh *col_mesh = dynamic_cast<CollisionMesh*>(col_mesh_);
        Quaternion q = check_quat(L, 2);
        Vector3 start = check_v3(L, 3);
        Vector3 ray = check_v3(L, 4);
        bool nearest_only = check_bool(L, 5);
        unsigned long flags = check_t<unsigned long>(L, 6);
        if (lua_type(L, 7) != LUA_TFUNCTION)
                my_lua_error(L, "Parameter 5 should be a function.");

        LuaSweepCallback lcb(nearest_only, flags);
        init_cast_blacklist(L, base_line, lcb);

        physics_sweep_col_mesh(start, q, start + ray, q, lcb, col_mesh);

        push_cfunction(L, my_lua_error_handler);
        int error_handler = lua_gettop(L);

        lcb.pushResults(L, 7, error_handler);
        return 0;
TRY_END
}
开发者ID:grit-engine,项目名称:grit-engine,代码行数:29,代码来源:lua_wrappers_physics.cpp


示例11: global_physics_test

static int global_physics_test (lua_State *L)
{
TRY_START
        LuaTestCallback lcb;
        push_cfunction(L, my_lua_error_handler);
        int error_handler = lua_gettop(L);
        if (lua_gettop(L)==5) {
                float radius = lua_tonumber(L, 1);
                Vector3 pos = check_v3(L, 2);
                bool only_dyn = check_bool(L, 3);
                if (lua_type(L, 4) != LUA_TFUNCTION)
                        my_lua_error(L, "Parameter 4 should be a function.");

                physics_test_sphere(radius, pos, only_dyn, lcb);
                lcb.pushResults(L, 4, error_handler);
        } else {
                check_args(L, 6);
                std::string col_mesh_name = check_path(L, 1);
                DiskResource *col_mesh_ = disk_resource_get_or_make(col_mesh_name);
                CollisionMesh *col_mesh = dynamic_cast<CollisionMesh*>(col_mesh_);
                if (col_mesh==NULL) my_lua_error(L, "Not a collision mesh: \""+col_mesh_name+"\"");
                if (!col_mesh->isLoaded()) my_lua_error(L, "Not loaded: \""+col_mesh_name+"\"");
                Vector3 pos = check_v3(L, 2);
                Quaternion quat = check_quat(L, 3);
                bool only_dyn = check_bool(L, 4);
                if (lua_type(L, 5) != LUA_TFUNCTION)
                        my_lua_error(L, "Parameter 5 should be a function.");

                physics_test(col_mesh, pos, quat, only_dyn, lcb);
                lcb.pushResults(L, 5, error_handler);
        }
        lua_pop(L, 1); // error handler
        return 0;
TRY_END
}
开发者ID:grit-engine,项目名称:grit-engine,代码行数:35,代码来源:lua_wrappers_physics.cpp


示例12: path_finder

int			path_finder(char **map, int number_path,
				    t_server *server)
{
  int			index_position_y;
  int			index_position_x;
  int			position[3];
  int			find_path;

  find_path = 0;
  for (index_position_y = 0; index_position_y < server->map.height;
       index_position_y++)
    {
      for (index_position_x = 0; index_position_x < server->map.width;
	   index_position_x++)
	{
	  position[0] = index_position_x;
	  position[1] = index_position_y;
	  position[2] = 0;
	  if (map[index_position_y][index_position_x] == number_path &&
	      check_path(map, position, number_path, server) != 0)
	    find_path = 1;
	}
    }
  return (find_path);
}
开发者ID:brieucdlf,项目名称:Zappy,代码行数:25,代码来源:find_path.c


示例13: rbody_ranged_scatter

static int rbody_ranged_scatter (lua_State *L)
{
TRY_START
        check_args(L, 12);
        GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);
        std::string mat    = check_path(L, 2);
        GET_UD_MACRO(GfxRangedInstancesPtr, gri, 3, GFXRANGEDINSTANCES_TAG);
        float density       = check_float(L, 4);
        float min_slope     = check_float(L, 5);
        float max_slope     = check_float(L, 6);
        float min_elevation = check_float(L, 7);
        float max_elevation = check_float(L, 8);
        bool no_z           = check_bool(L, 9);
        bool rotate         = check_bool(L, 10);
        bool align_slope    = check_bool(L, 11);
        unsigned seed       = check_t<unsigned>(L, 12);

        SimpleTransform world_trans(self.getPosition(), self.getOrientation());

        self.colMesh->scatter(phys_mats.getMaterial(mat)->id,
                              world_trans, density, min_slope, max_slope, min_elevation,
                              max_elevation, no_z, rotate, align_slope, seed,
                              *gri);

        return 0;
TRY_END
}
开发者ID:grit-engine,项目名称:grit-engine,代码行数:27,代码来源:lua_wrappers_physics.cpp


示例14: mu_index_run

MuError
mu_index_run (MuIndex *index, const char *path,
	      gboolean reindex, MuIndexStats *stats,
	      MuIndexMsgCallback msg_cb, MuIndexDirCallback dir_cb,
	      void *user_data)
{
	MuIndexCallbackData cb_data;
	MuError rv;

	g_return_val_if_fail (index && index->_store, MU_ERROR);
	g_return_val_if_fail (msg_cb, MU_ERROR);

	if (!check_path (path))
		return MU_ERROR;

	if (!reindex && index->_needs_reindex) {
		g_warning ("database not up-to-date; needs full reindex");
		return MU_ERROR;
	}

	init_cb_data (&cb_data, index->_store, reindex,
		      index->_max_filesize, stats,
		      msg_cb, dir_cb, user_data);

	rv = mu_maildir_walk (path,
			      (MuMaildirWalkMsgCallback)on_run_maildir_msg,
			      (MuMaildirWalkDirCallback)on_run_maildir_dir,
			      reindex, /* re-index, ie. do a full update */
			      &cb_data);

	mu_store_flush (index->_store);

	return rv;
}
开发者ID:Dabg,项目名称:mu,代码行数:34,代码来源:mu-index.c


示例15: on_lineEdit_target_product_textChanged

void Dialog::on_lineEdit_target_product_textChanged(const QString &arg1)
{
    if(check_path() == false)
        ui->pushButton_edit_path->setDisabled(true);
    else
        ui->pushButton_edit_path->setDisabled(false);
}
开发者ID:kangear,项目名称:DebuggingAssistant,代码行数:7,代码来源:dialog.cpp


示例16: get_requests

int get_requests(int fd)
{
  char *buf;
  char *destroylist[256];
  int dll;
  int i;

  dll = 0;
  while(1) {
    if(dll >= 255) break;

    buf = calloc(REQSZ, 1);
    if(read(fd, buf, REQSZ) != REQSZ) break;

    if(strncmp(buf, "FSRD", 4) != 0) break;

    check_path(buf + 4);    

    dll++;
  }

  for(i = 0; i < dll; i++) {
                write(fd, "Process OK\n", strlen("Process OK\n"));
    free(destroylist[i]);
  }
}
开发者ID:capturePointer,项目名称:exploit-exercises,代码行数:26,代码来源:final2.c


示例17: check_path

static int		check_path(t_env *data, int step)
{
	int		i;
	t_room	*ptr;

	i = 0;
	ptr = data->rooms;
	if (step > data->nb_room)
		return (0);
	while (ptr)
	{
		if (ptr->weight == step - 1)
		{
			while (ptr->link && ptr->link[i])
			{
				if (!(ptr->link[i]->weight))
					ptr->link[i]->weight = step;
				i++;
			}
			i = 0;
		}
		ptr = ptr->next;
	}
	if (complete_path(data))
		return (1);
	return (check_path(data, step + 1));
}
开发者ID:lalves42,项目名称:42Projects,代码行数:27,代码来源:parsing.c


示例18: nghttp2_http_on_request_headers

int nghttp2_http_on_request_headers(nghttp2_stream *stream,
                                    nghttp2_frame *frame) {
  if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
    if ((stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) {
      return -1;
    }
    stream->content_length = -1;
  } else {
    if ((stream->http_flags & NGHTTP2_HTTP_FLAG_REQ_HEADERS) !=
            NGHTTP2_HTTP_FLAG_REQ_HEADERS ||
        (stream->http_flags &
         (NGHTTP2_HTTP_FLAG__AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) {
      return -1;
    }
    if (!check_path(stream)) {
      return -1;
    }
  }

  if (frame->hd.type == NGHTTP2_PUSH_PROMISE) {
    /* we are going to reuse data fields for upcoming response.  Clear
       them now, except for method flags. */
    stream->http_flags &= NGHTTP2_HTTP_FLAG_METH_ALL;
    stream->content_length = -1;
  }

  return 0;
}
开发者ID:LambdaOS,项目名称:nghttp2,代码行数:28,代码来源:nghttp2_http.c


示例19: show

/* PRINT FILE */
void 
show(char *filename)
{
	int		fd        , n;
	char		buf       [128];
	char           *fname = 0;

	fname = malloc(strlen(glpath) + strlen(filename) + 2);
	sprintf(fname, "%s/%s", glpath, filename);
	if (!check_path(fname))
		sprintf(fname, "/%s", filename);

	if ((fd = open(fname, O_RDONLY)) != -1) {
		while ((n = read(fd, buf, sizeof(buf))) > 0)
			printf("%.*s", n, buf);
		close(fd);
	} else {
		sprintf(fname, "/%s", filename);
		if ((fd = open(fname, O_RDONLY)) != -1) {
			while ((n = read(fd, buf, sizeof(buf))) > 0)
				printf("%.*s", n, buf);
			close(fd);
		}
	}
	free(fname);
}
开发者ID:Duplex923,项目名称:pzs-ng,代码行数:27,代码来源:sitewho.c


示例20: path_exists

int path_exists(int *maze, int rows, int columns, int x1, int y1, int x2, int y2){

	if (rows < 0 || columns < 0 || x1 < 0 || y1 < 0 || x2 < 0 || y2 < 0 || x1 >= rows || x2 >= rows || y1 >= columns || y2 >= columns)
		return 0;
	else
		return check_path(maze, rows, columns, x1, y1, x2, y2);
}
开发者ID:babivinay,项目名称:MissionRnD-C-Recursion-Worksheet,代码行数:7,代码来源:Maze.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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