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


C++ path_exists函数代码示例

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


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

示例1: exclude_file_name

void
exclude_file_name(char path[])
{
	if(path_exists(path, DEREF) && !is_valid_dir(path))
	{
		remove_last_path_component(path);
	}
}
开发者ID:jubalh,项目名称:vifm,代码行数:8,代码来源:path.c

示例2: try_myvifmrc_envvar_for_vifmrc

/* Tries to use $MYVIFMRC as configuration file.  Returns non-zero on success,
 * otherwise zero is returned. */
static int
try_myvifmrc_envvar_for_vifmrc(void)
{
	LOG_FUNC_ENTER;

	const char *myvifmrc = env_get(MYVIFMRC_EV);
	return myvifmrc != NULL && path_exists(myvifmrc, DEREF);
}
开发者ID:phantasea,项目名称:vifm,代码行数:10,代码来源:config.c

示例3: verify_existence

static void verify_existence(char **options, const char *name, int is_dir) {
  const char *path = get_option(options, name);
  if (!path_exists(path, is_dir)) {
    notify("Invalid path for %s: [%s]: (%s). Make sure that path is either "
           "absolute, or it is relative to mongoose executable.",
           name, path, strerror(errno));
  }
}
开发者ID:rafaelscb,项目名称:umbrella,代码行数:8,代码来源:umserver.c

示例4: do_create

static inline int do_create(const char *path ,int mode)
{
  if(NO == path_exists(path))
    {
      return mkdir(path ,mode);
    }
  
  return PATH_IS_THERE;
}
开发者ID:NalaGinrut,项目名称:ragnarok,代码行数:9,代码来源:create_this_path.c

示例5: StageIn_end

int gmShellPlink::StageIn(const gmdArrayString& locfiles, pCSTR remdir, unsigned flags){
  gmdString tempdir, src, err;
  gmdArrayString srclist;

  if( StageIn_begin(NULL, remdir, flags) )
    return StageIn_end(NULL, remdir, flags);

  for(unsigned i=0; i<locfiles.GetCount(); i++) {
    gmdString lfile = locfiles[i];
    if( lfile.IsEmpty() ) continue;
    lfile.Replace("/", "\\");

    if( has_wildcards(lfile) ) {
      // List all files explicitly if lfile contains wildcards
      gmdArrayString filelist;
      unsigned nfiles = files_by_mask(lfile, filelist, flags);
      if(nfiles)
        for(unsigned k=0; k<nfiles; k++) srclist.Add(filelist[k]);
      else
        set_err(NO_INPUT_FILE, fmt("%s: no such files", (pCSTR)lfile.c_str()));
    }
    else if( path_exists(lfile, flags) )
      srclist.Add(lfile);
    else
      set_err(NO_INPUT_FILE, fmt("%s: no sich file or directory", (pCSTR)lfile.c_str()));
  }

  if( !srclist.IsEmpty() ) {
    if(flags & TEXT) {
      // Convert text files and store them in the temporary dir
      assert_no_recursive(flags);  // combination RECURSIVE & TEXT is not supported!
      tempdir = GetTempDir();
      //dos2unix(srclist, tempdir);
      conv_files(srclist, tempdir, dos2unix);
      src = tempdir + "\\*.*";
    } else {
      // prepare the space separated file list for PLINK
      for(unsigned i=0; i<srclist.GetCount(); i++)
        src += (i>0 ? "\" \"" : "") + srclist[i];
    }

    // Copy files
    if(!error_code) {
      gmdString args = (flags & RECURSIVE) ? "-r \"" : "\"";
      args += src + "\" \"" + userhost + ':' + rem_path_subst(remdir) + "\"";
      pscp_execute(args);
    }

    if( !tempdir.IsEmpty() ) remove_local(tempdir);

    if(!error_code && (flags & MOVE))  // custom move (not using StageIn_end)
      for(unsigned i=0; i<srclist.GetCount(); i++) RemoveLocal(srclist[i], flags);
  }

  return StageIn_end(NULL, remdir, flags);
}
开发者ID:ilya-valuev,项目名称:GridMD,代码行数:56,代码来源:plinkshell.cpp

示例6: copy_device_support_path

CFStringRef copy_device_support_path(AMDeviceRef device) {
    CFStringRef version = AMDeviceCopyValue(device, 0, CFSTR("ProductVersion"));
    CFStringRef build = AMDeviceCopyValue(device, 0, CFSTR("BuildVersion"));
    const char* home = getenv("HOME");
    CFStringRef path;
    bool found = false;

    path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/%@ (%@)"), home, version, build);
    found = path_exists(path);

    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)"), version, build);
        found = path_exists(path);
    }
    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/%@"), home, version);
        found = path_exists(path);
    }
    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
        found = path_exists(path);
    }
    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
        found = path_exists(path);
    }

    CFRelease(version);
    CFRelease(build);

    if (!found)
    {
        CFRelease(path);
        printf("[ !! ] Unable to locate DeviceSupport directory.\n");
        exit(1);
    }

    return path;
}
开发者ID:ccastleb,项目名称:fruitstrap,代码行数:43,代码来源:fruitstrap.c

示例7: path_delete

void path_delete(unsigned pathid)
{
    #ifdef DEBUG_MODE
    if (!path_exists(pathid)){
        show_error("Attempting to delete invalid path "+toString(pathid), false);
        return;
    }
    #endif
    delete enigma::pathstructarray[pathid];
}
开发者ID:JustForkMyLifeUpFam,项目名称:enigma-dev,代码行数:10,代码来源:path_functions.cpp

示例8: add_configfs_base

static int add_configfs_base(void)
{
	int rv = 0;

	if (!path_exists("/sys/kernel/config")) {
		log_error("No /sys/kernel/config, is configfs loaded?");
		return -1;
	}

	if (!path_exists("/sys/kernel/config/dlm")) {
		log_error("No /sys/kernel/config/dlm, is the dlm loaded?");
		return -1;
	}

	if (!path_exists("/sys/kernel/config/dlm/cluster"))
		rv = create_path("/sys/kernel/config/dlm/cluster");

	return rv;
}
开发者ID:smintz,项目名称:cluster,代码行数:19,代码来源:action.c

示例9: androidPartitionType_probeFile

AndroidPartitionType androidPartitionType_probeFile(const char* image_file) {
    if (!path_exists(image_file)) {
        return ANDROID_PARTITION_TYPE_UNKNOWN;
    }
    if (android_pathIsExt4PartitionImage(image_file)) {
        return ANDROID_PARTITION_TYPE_EXT4;
    }
    // Assume YAFFS2, since there is little way to be sure for now.
    // NOTE: An empty file is a valid Yaffs2 file!
    return ANDROID_PARTITION_TYPE_YAFFS2;
}
开发者ID:Acidburn0zzz,项目名称:platform_external_qemu,代码行数:11,代码来源:partition_types.cpp

示例10: follow_link

/* Resolve link target and either navigate inside directory link points to or
 * navigate to directory where target is located pointing cursor on
 * it (the follow_dirs flag controls behaviour). */
static void
follow_link(FileView *view, int follow_dirs)
{
	char *dir, *file;
	char full_path[PATH_MAX];
	char linkto[PATH_MAX + NAME_MAX];
	dir_entry_t *const entry = &curr_view->dir_entry[curr_view->list_pos];

	get_full_path_of(entry, sizeof(full_path), full_path);

	if(get_link_target_abs(full_path, entry->origin, linkto, sizeof(linkto)) != 0)
	{
		show_error_msg("Error", "Can't read link.");
		return;
	}

	if(!path_exists(linkto, DEREF))
	{
		show_error_msg("Broken Link",
				"Can't access link destination.  It might be broken.");
		return;
	}

	chosp(linkto);

	if(is_dir(linkto) && !follow_dirs)
	{
		dir = strdup(entry->name);
		file = NULL;
	}
	else
	{
		dir = strdup(linkto);
		remove_last_path_component(dir);

		file = get_last_path_component(linkto);
	}

	if(dir[0] != '\0')
	{
		navigate_to(view, dir);
	}

	if(file != NULL)
	{
		const int pos = find_file_pos_in_list(view, file);
		if(pos >= 0)
		{
			flist_set_pos(view, pos);
		}
	}

	free(dir);
}
开发者ID:cfillion,项目名称:vifm,代码行数:57,代码来源:running.c

示例11: copy_device_support_path

CFStringRef copy_device_support_path(AMDeviceRef device) {
    CFStringRef version = AMDeviceCopyValue(device, 0, CFSTR("ProductVersion"));
    CFStringRef build = AMDeviceCopyValue(device, 0, CFSTR("BuildVersion"));
    CFStringRef path_with_build = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)"), version, build);
    CFStringRef path_without_build = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
    CFRelease(version);
    CFRelease(build);

    // they tack the build number on for beta builds
    // there is almost certainly a better way of doing this
    if (path_exists(path_with_build)) {
        CFRelease(path_without_build);
        return path_with_build;
    } else if (path_exists(path_without_build)) {
        CFRelease(path_with_build);
        return path_without_build;
    } else {
        printf("[ !! ] Unable to locate DeviceSupport directory.\n");
        exit(1);
    }
}
开发者ID:MaksimKovalyov,项目名称:fruitstrap,代码行数:21,代码来源:fruitstrap.c

示例12: parse_pathspec_arg

static void parse_pathspec_arg(const char **pathspec,
		struct archiver_args *ar_args)
{
	ar_args->pathspec = pathspec = get_pathspec("", pathspec);
	if (pathspec) {
		while (*pathspec) {
			if (!path_exists(ar_args->tree, *pathspec))
				die("path not found: %s", *pathspec);
			pathspec++;
		}
	}
}
开发者ID:Jinyan,项目名称:git,代码行数:12,代码来源:archive.c

示例13: _getSdkImage

static char*
_getSdkImage( const char*  path, const char*  file )
{
    char  temp[MAX_PATH];
    char  *p = temp, *end = p + sizeof(temp);

    p = bufprint(temp, end, "%s/%s", path, file);
    if (p >= end || !path_exists(temp))
        return NULL;

    return android_strdup(temp);
}
开发者ID:MIPS,项目名称:external-qemu,代码行数:12,代码来源:main-ui.c

示例14: _checkSkinPath

/* check that a given directory contains a valid skin.
 * returns 1 on success, 0 on failure.
 */
static int
_checkSkinPath( const char*  skinPath )
{
    char  temp[MAX_PATH], *p=temp, *end=p+sizeof(temp);

    /* for now, if it has a 'layout' file, it is a valid skin path */
    p = bufprint(temp, end, "%s/layout", skinPath);
    if (p >= end || !path_exists(temp))
        return 0;

    return 1;
}
开发者ID:bindassdost,项目名称:razrd,代码行数:15,代码来源:info.c

示例15: path_getBuildBootProp

char* path_getBuildBootProp(const char* androidOut) {
    char temp[MAX_PATH], *p = temp, *end = p + sizeof(temp);
    p = bufprint(temp, end, "%s/boot.prop", androidOut);
    if (p >= end) {
        D("ANDROID_BUILD_OUT is too long: %s\n", androidOut);
        return NULL;
    }
    if (!path_exists(temp)) {
        D("Cannot find boot properties file: %s\n", temp);
        return NULL;
    }
    return ASTRDUP(temp);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_qemu,代码行数:13,代码来源:util.c


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