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

C++ path_get_extension函数代码示例

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

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



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

示例1: find_first_libretro

static bool find_first_libretro(char *path, size_t size,
      const char *dir, const char *rom_path)
{
   bool ret = false;
   const char *ext = path_get_extension(rom_path);
   if (!ext || !*ext)
   {
      RARCH_ERR("Path has no extension. Cannot infer libretro implementation.\n");
      return false;
   }

   RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir);

   struct string_list *list = dir_list_new(dir, DYNAMIC_EXT, false);
   if (!list)
   {
      RARCH_ERR("Couldn't open directory: \"%s\".\n", dir);
      return false;
   }

   for (size_t i = 0; i < list->size && !ret; i++)
   {
      RARCH_LOG("Checking library: \"%s\".\n", list->elems[i].data);
      dylib_t lib = dylib_load(list->elems[i].data);
      if (!lib)
         continue;

      void (*proc)(struct retro_system_info*) = 
         (void (*)(struct retro_system_info*))dylib_proc(lib, "retro_get_system_info");

      if (!proc)
      {
         dylib_close(lib);
         continue;
      }

      struct retro_system_info info = {0};
      proc(&info);

      if (!info.valid_extensions)
      {
         dylib_close(lib);
         continue;
      }

      struct string_list *supported_ext = string_split(info.valid_extensions, "|"); 

      if (string_list_find_elem(supported_ext, ext))
      {
         strlcpy(path, list->elems[i].data, size);
         ret = true;
      }

      string_list_free(supported_ext);
      dylib_close(lib);
   }

   dir_list_free(list);
   return ret;
}
开发者ID:barnhilltrckn,项目名称:RetroArch-1,代码行数:60,代码来源:dynamic.c


示例2: core_info_database_supports_content_path

bool core_info_database_supports_content_path(const char *database_path, const char *path)
{
   size_t i;
   char *database = NULL;

   if (!core_info_curr_list)
      return false;

   database = strdup(path_basename(database_path));

   path_remove_extension(database);

   for (i = 0; i < core_info_curr_list->count; i++)
   {
      const core_info_t *info = &core_info_curr_list->list[i];

      if (string_list_find_elem(info->supported_extensions_list, path_get_extension(path)))
         if (string_list_find_elem(info->databases_list, database))
         {
            free(database);
            return true;
         }
   }

   free(database);
   return false;
}
开发者ID:KitoHo,项目名称:RetroArch,代码行数:27,代码来源:core_info.c


示例3: title_sequence_rename_save

void title_sequence_rename_save(int preset, int index, const char *newName)
{
	if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index >= 0 && index < gConfigTitleSequences.presets[preset].num_saves &&
		filename_valid_characters(newName) && !title_sequence_save_exists(preset, newName)) {

		// Rename the save file
		char separator = platform_get_path_separator();
		utf8 src[MAX_PATH], dest[MAX_PATH];
		platform_get_user_directory(src, "title sequences");
		platform_get_user_directory(dest, "title sequences");
		strcat(src, gConfigTitleSequences.presets[preset].name);
		strcat(dest, gConfigTitleSequences.presets[preset].name);
		strncat(src, &separator, 1);
		strncat(dest, &separator, 1);
		strcat(src, gConfigTitleSequences.presets[preset].saves[index]);
		strcat(dest, newName);
		// Add the appropriate extension if needed
		char *extension = (char*)path_get_extension(newName);
		if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
			strcat(dest, ".sv6");
		platform_file_move(src, dest);

		safe_strncpy(gConfigTitleSequences.presets[preset].saves[index], newName, TITLE_SEQUENCE_MAX_SAVE_LENGTH);
		// Add the appropriate extension if needed
		if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
			strcat(gConfigTitleSequences.presets[preset].saves[index], ".sv6");
		title_sequence_save_preset_script(preset);
	}
}
开发者ID:Aitchwing,项目名称:OpenRCT2,代码行数:29,代码来源:title_sequences.c


示例4: calloc

static void *hlsl_init(void *data, const char *path)
{
   unsigned i;
   d3d_video_t *d3d = (d3d_video_t*)data;
   hlsl_shader_data_t *hlsl_data = (hlsl_shader_data_t*)
      calloc(1, sizeof(hlsl_shader_data_t));

   if (!hlsl_data)
	   return NULL;

   if (path && (string_is_equal_fast(path_get_extension(path), ".cgp", 4)))
   {
      if (!hlsl_load_preset(hlsl_data, d3d, path))
         goto error;
   }
   else
   {
      if (!hlsl_load_plain(hlsl_data, d3d, path))
         goto error;
   }

   for(i = 1; i <= hlsl_data->cg_shader->passes; i++)
      hlsl_set_program_attributes(hlsl_data, i);

   d3d_set_vertex_shader(d3d->dev, 1, hlsl_data->prg[1].vprg);
   d3d->dev->SetPixelShader(hlsl_data->prg[1].fprg);

   return hlsl_data;

error:
   if (hlsl_data)
	   free(hlsl_data);
   return NULL;
}
开发者ID:arakerlu,项目名称:RetroArch,代码行数:34,代码来源:shader_hlsl.c


示例5: cmd_set_shader

static bool cmd_set_shader(const char *arg)
{
   if (!driver.video->set_shader)
      return false;

   enum rarch_shader_type type = RARCH_SHADER_NONE;
   const char *ext = path_get_extension(arg);

   if (strcmp(ext, "glsl") == 0 || strcmp(ext, "glslp") == 0)
      type = RARCH_SHADER_GLSL;
   else if (strcmp(ext, "cg") == 0 || strcmp(ext, "cgp") == 0)
      type = RARCH_SHADER_CG;

   if (type == RARCH_SHADER_NONE)
      return false;

   msg_queue_clear(g_extern.msg_queue);

   char msg[PATH_MAX];
   snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg);
   msg_queue_push(g_extern.msg_queue, msg, 1, 120);
   RARCH_LOG("Applying shader \"%s\".\n", arg);

   return video_set_shader_func(type, arg);
}
开发者ID:ChowZenki,项目名称:RetroArch,代码行数:25,代码来源:command.c


示例6: file_archive_extract_cb

static int file_archive_extract_cb(const char *name, const char *valid_exts,
                                   const uint8_t *cdata,
                                   unsigned cmode, uint32_t csize, uint32_t size,
                                   uint32_t checksum, void *userdata)
{
    const char *ext                   = path_get_extension(name);
    struct zip_extract_userdata *data = (struct zip_extract_userdata*)userdata;

    /* Extract first content that matches our list. */
    if (ext && string_list_find_elem(data->ext, ext))
    {
        char new_path[PATH_MAX_LENGTH] = {0};

        if (data->extraction_directory)
            fill_pathname_join(new_path, data->extraction_directory,
                               path_basename(name), sizeof(new_path));
        else
            fill_pathname_resolve_relative(new_path, data->zip_path,
                                           path_basename(name), sizeof(new_path));

        data->first_extracted_file_path = strdup(new_path);
        data->found_content             = file_archive_perform_mode(new_path,
                                          valid_exts, cdata, cmode, csize, size,
                                          0, NULL);
        return 0;
    }

    return 1;
}
开发者ID:GeneralFailer,项目名称:RetroArch,代码行数:29,代码来源:archive_file.c


示例7: core_info_does_support_file

bool core_info_does_support_file(const core_info_t *core, const char *path)
{
   if (!path || !core || !core->supported_extensions_list)
      return false;

   return string_list_find_elem_prefix(core->supported_extensions_list, ".", path_get_extension(path));
}
开发者ID:budney93,项目名称:RetroArch,代码行数:7,代码来源:core_info.c


示例8: hlsl_init

static bool hlsl_init(const char *path)
{
   xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;

   if (path && strcmp(path_get_extension(path), ".cgp") == 0)
   {
      if (!load_preset(path))
         return false;
   }
   else
   {
      if (!load_plain(path))
         return false;
   }

   for(unsigned i = 1; i <= cg_shader->passes; i++)
      set_program_attributes(i);

   d3d_device_ptr = d3d->d3d_render_device;
   d3d->d3d_render_device->SetVertexShader(prg[1].vprg);
   d3d->d3d_render_device->SetPixelShader(prg[1].fprg);

   hlsl_active = true;
   return true;
}
开发者ID:AbelFlos,项目名称:RetroArch,代码行数:25,代码来源:shader_hlsl.c


示例9: cmd_set_shader

static bool cmd_set_shader(const char *arg)
{
   char msg[PATH_MAX_LENGTH]   = {0};
   enum rarch_shader_type type = RARCH_SHADER_NONE;
   const char             *ext = path_get_extension(arg);
   uint32_t ext_hash           = msg_hash_calculate(ext);

   switch (ext_hash)
   {
      case COMMAND_EXT_GLSL:
      case COMMAND_EXT_GLSLP:
         type = RARCH_SHADER_GLSL;
         break;
      case COMMAND_EXT_CG:
      case COMMAND_EXT_CGP:
         type = RARCH_SHADER_CG;
         break;
      default:
         return false;
   }

   snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg);
   rarch_main_msg_queue_push(msg, 1, 120, true);
   RARCH_LOG("%s \"%s\".\n",
         msg_hash_to_str(MSG_APPLYING_SHADER),
         arg);

   return video_driver_set_shader(type, arg);
}
开发者ID:jeapostrophe,项目名称:RetroArch,代码行数:29,代码来源:command.c


示例10: title_sequence_add_save

void title_sequence_add_save(int preset, const char *path, const char *newName)
{
	utf8 newPath[MAX_PATH];
	char *extension = (char*)path_get_extension(newName);
	safe_strncpy(newPath, newName, MAX_PATH);
	if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
		strcat(newPath, ".sv6");
	if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && filename_valid_characters(newPath) && !title_sequence_save_exists(preset, newPath) && platform_file_exists(path)) {
		// Copy the save file
		char separator = platform_get_path_separator();
		platform_get_user_directory(newPath, "title sequences");
		strcat(newPath, gConfigTitleSequences.presets[preset].name);
		strncat(newPath, &separator, 1);
		strcat(newPath, newName);
		// Add the appropriate extension if needed
		if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
			strcat(newPath, ".sv6");
		platform_file_copy(path, newPath, false);

		gConfigTitleSequences.presets[preset].num_saves++;
		gConfigTitleSequences.presets[preset].saves = realloc(gConfigTitleSequences.presets[preset].saves, sizeof(char[TITLE_SEQUENCE_MAX_SAVE_LENGTH]) * (size_t)gConfigTitleSequences.presets[preset].num_saves);

		safe_strncpy(gConfigTitleSequences.presets[preset].saves[gConfigTitleSequences.presets[preset].num_saves - 1], newName, TITLE_SEQUENCE_MAX_SAVE_LENGTH);
		// Add the appropriate extension if needed
		if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
			strcat(gConfigTitleSequences.presets[preset].saves[gConfigTitleSequences.presets[preset].num_saves - 1], ".sv6");
	}
}
开发者ID:Aitchwing,项目名称:OpenRCT2,代码行数:28,代码来源:title_sequences.c


示例11: d3d_process_shader

bool d3d_process_shader(void *data)
{
   D3DVideo *d3d = reinterpret_cast<D3DVideo*>(data);
   if (strcmp(path_get_extension(d3d->cg_shader.c_str()), "cgp") == 0)
      return d3d_init_multipass(d3d);

   return d3d_init_singlepass(d3d);
}
开发者ID:Gamesonic,项目名称:RetroArch,代码行数:8,代码来源:d3d9_pc.cpp


示例12: d3d_process_shader

static bool d3d_process_shader(d3d_video_t *d3d)
{
#ifdef HAVE_FBO
   if (string_is_equal(path_get_extension(d3d->shader_path.c_str()), "cgp"))
      return d3d_init_multipass(d3d);
#endif

   return d3d_init_singlepass(d3d);
}
开发者ID:XavierMoon,项目名称:RetroArch,代码行数:9,代码来源:d3d.cpp


示例13: d3d_process_shader

static bool d3d_process_shader(d3d_video_t *d3d)
{
#ifdef HAVE_FBO
   if (strcmp(path_get_extension(d3d->cg_shader.c_str()), "cgp") == 0)
      return d3d_init_multipass(d3d);
#endif

   return d3d_init_singlepass(d3d);
}
开发者ID:ChowZenki,项目名称:RetroArch,代码行数:9,代码来源:d3d.cpp


示例14: type_is_prioritized

static bool type_is_prioritized(const char *path)
{
   const char *ext = path_get_extension(path);
   if (string_is_equal_noncase(ext, "cue"))
      return true;
   if (string_is_equal_noncase(ext, "gdi"))
      return true;
   return false;
}
开发者ID:RobLoach,项目名称:RetroArch,代码行数:9,代码来源:database_info.c


示例15: check_shader_dir

/**
 * check_shader_dir:
 * @pressed_next         : was next shader key pressed?
 * @pressed_previous     : was previous shader key pressed?
 *
 * Checks if any one of the shader keys has been pressed for this frame:
 * a) Next shader index.
 * b) Previous shader index.
 *
 * Will also immediately apply the shader.
 **/
static void check_shader_dir(rarch_dir_list_t *dir_list,
      bool pressed_next, bool pressed_prev)
{
   uint32_t ext_hash;
   char msg[128];
   const char *shader          = NULL;
   const char *ext             = NULL;
   enum rarch_shader_type type = RARCH_SHADER_NONE;

   if (!dir_list || !dir_list->list)
      return;

   if (pressed_next)
   {
      dir_list->ptr = (dir_list->ptr + 1) %
         dir_list->list->size;
   }
   else if (pressed_prev)
   {
      if (dir_list->ptr == 0)
         dir_list->ptr = dir_list->list->size - 1;
      else
         dir_list->ptr--;
   }
   else
      return;

   shader   = dir_list->list->elems[dir_list->ptr].data;
   ext      = path_get_extension(shader);
   ext_hash = msg_hash_calculate(ext);

   switch (ext_hash)
   {
      case SHADER_EXT_GLSL:
      case SHADER_EXT_GLSLP:
         type = RARCH_SHADER_GLSL;
         break;
      case SHADER_EXT_CG:
      case SHADER_EXT_CGP:
         type = RARCH_SHADER_CG;
         break;
      default:
         return;
   }

   snprintf(msg, sizeof(msg), "%s #%u: \"%s\".",
         msg_hash_to_str(MSG_SHADER),
         (unsigned)dir_list->ptr, shader);
   runloop_msg_queue_push(msg, 1, 120, true);

   RARCH_LOG("%s \"%s\".\n",
         msg_hash_to_str(MSG_APPLYING_SHADER),
         shader);

   if (!video_driver_set_shader(type, shader))
      RARCH_WARN("%s\n", msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER));
}
开发者ID:Muki-SkyWalker,项目名称:RetroArch,代码行数:68,代码来源:runloop.c


示例16: init_content_file_extract

static bool init_content_file_extract(
      struct string_list *temporary_content,
      struct string_list *content,
      rarch_system_info_t *system,
      const struct retro_subsystem_info *special,
      union string_list_elem_attr *attr
      )
{
   unsigned i;
   settings_t *settings = config_get_ptr();

   for (i = 0; i < content->size; i++)
   {
      const char *ext       = NULL;
      const char *valid_ext = system->info.valid_extensions;

      /* Block extract check. */
      if (content->elems[i].attr.i & 1)
         continue;

      ext                   = path_get_extension(content->elems[i].data);

      if (special)
         valid_ext          = special->roms[i].valid_extensions;

      if (!ext)
         continue;

      if (string_is_equal_noncase(ext, "zip"))
      {
         char new_path[PATH_MAX_LENGTH];
         char temp_content[PATH_MAX_LENGTH];

         strlcpy(temp_content, content->elems[i].data,
               sizeof(temp_content));

         if (!file_archive_extract_first_content_file(temp_content,
                  sizeof(temp_content), valid_ext,
                  *settings->cache_directory ?
                  settings->cache_directory : NULL,
                  new_path, sizeof(new_path)))
         {
            RARCH_ERR("Failed to extract content from zipped file: %s.\n",
                  temp_content);
            return false;
         }

         string_list_set(content, i, new_path);
         if (!string_list_append(temporary_content,
                  new_path, *attr))
            return false;
      }
   }
   
   return true;
}
开发者ID:jwarby,项目名称:RetroArch,代码行数:56,代码来源:content.c


示例17: check_shader_dir

/**
 * check_shader_dir:
 * @pressed_next         : was next shader key pressed?
 * @pressed_previous     : was previous shader key pressed?
 *
 * Checks if any one of the shader keys has been pressed for this frame: 
 * a) Next shader index.
 * b) Previous shader index.
 *
 * Will also immediately apply the shader.
 **/
static void check_shader_dir(global_t *global,
      bool pressed_next, bool pressed_prev)
{
   uint32_t ext_hash;
   char msg[PATH_MAX_LENGTH]   = {0};
   const char *shader          = NULL;
   const char *ext             = NULL;
   enum rarch_shader_type type = RARCH_SHADER_NONE;

   if (!global || !global->shader_dir.list)
      return;

   if (pressed_next)
   {
      global->shader_dir.ptr = (global->shader_dir.ptr + 1) %
         global->shader_dir.list->size;
   }
   else if (pressed_prev)
   {
      if (global->shader_dir.ptr == 0)
         global->shader_dir.ptr = global->shader_dir.list->size - 1;
      else
         global->shader_dir.ptr--;
   }
   else
      return;

   shader   = global->shader_dir.list->elems[global->shader_dir.ptr].data;
   ext      = path_get_extension(shader);
   ext_hash = msg_hash_calculate(ext);

   switch (ext_hash)
   {
      case SHADER_EXT_GLSL:
      case SHADER_EXT_GLSLP:
         type = RARCH_SHADER_GLSL;
         break;
      case SHADER_EXT_CG:
      case SHADER_EXT_CGP:
         type = RARCH_SHADER_CG;
         break;
      default:
         return;
   }

   snprintf(msg, sizeof(msg), "%s #%u: \"%s\".",
         msg_hash_to_str(MSG_SHADER),
         (unsigned)global->shader_dir.ptr, shader);
   rarch_main_msg_queue_push(msg, 1, 120, true);
   RARCH_LOG("%s \"%s\".\n",
         msg_hash_to_str(MSG_APPLYING_SHADER),
         shader);

   if (!video_driver_set_shader(type, shader))
      RARCH_WARN(msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER));
}
开发者ID:rglass01,项目名称:RetroArch,代码行数:67,代码来源:runloop.c


示例18: init_rom_file

bool init_rom_file(enum rarch_game_type type)
{
#ifdef HAVE_ZLIB
   if (*g_extern.fullpath && !g_extern.system.block_extract)
   {
      const char *ext = path_get_extension(g_extern.fullpath);
      if (ext && !strcasecmp(ext, "zip"))
      {
         g_extern.rom_file_temporary = true;

         if (!zlib_extract_first_rom(g_extern.fullpath, sizeof(g_extern.fullpath), g_extern.system.valid_extensions))
         {
            RARCH_ERR("Failed to extract ROM from zipped file: %s.\n", g_extern.fullpath);
            g_extern.rom_file_temporary = false;
            return false;
         }

         strlcpy(g_extern.last_rom, g_extern.fullpath, sizeof(g_extern.last_rom));
      }
   }
#endif

   switch (type)
   {
      case RARCH_CART_SGB:
         if (!load_sgb_rom())
            return false;
         break;

      case RARCH_CART_NORMAL:
         if (!load_normal_rom())
            return false;
         break;

      case RARCH_CART_BSX:
         if (!load_bsx_rom(false))
            return false;
         break;

      case RARCH_CART_BSX_SLOTTED:
         if (!load_bsx_rom(true))
            return false;
         break;

      case RARCH_CART_SUFAMI:
         if (!load_sufami_rom())
            return false;
         break;
         
      default:
         RARCH_ERR("Invalid ROM type.\n");
         return false;
   }

   return true;
}
开发者ID:netux79,项目名称:myra1002,代码行数:56,代码来源:file.c


示例19: video_shader_parse_type

/**
 * video_shader_parse_type:
 * @path              : Shader path.
 * @fallback          : Fallback shader type in case no
 *                      type could be found.
 *
 * Parses type of shader.
 *
 * Returns: value of shader type on success, otherwise will return
 * user-supplied @fallback value.
 **/
enum rarch_shader_type video_shader_parse_type(const char *path,
      enum rarch_shader_type fallback)
{
   bool is_preset                     = false;

   if (!path)
      return fallback;
   return  video_shader_get_type_from_ext(path_get_extension(path),
         &is_preset);
}
开发者ID:RobLoach,项目名称:RetroArch,代码行数:21,代码来源:video_shader_parse.c


示例20: visit

 void visit(const char* name)
 {
   const char* subname = path_make_relative(name, m_directory);
   if(subname != name)
   {
     if(subname[0] == '/')
       ++subname;
     if(m_extension[0] == '*' || extension_equal(path_get_extension(subname), m_extension))
       pathlist_prepend_unique(m_matches, g_strdup (subname));
   }
 }
开发者ID:clbr,项目名称:netradiant,代码行数:11,代码来源:vfs.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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