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


C++ path_file_exists函数代码示例

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


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

示例1: salamander_init

static void salamander_init(void)
{
   CellPadData pad_data;
   cellPadInit(7);

   cellPadGetData(0, &pad_data);

   if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
   {
      //override path, boot first executable in cores directory
      RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
      find_and_set_first_file();
   }
   else
   {
      //normal executable loading path
      char tmp_str[PATH_MAX];
      bool config_file_exists = false;

      if (path_file_exists(config_path))
         config_file_exists = true;

      //try to find CORE executable
      char core_executable[1024];
      fill_pathname_join(core_executable, default_paths.core_dir, "CORE.SELF", sizeof(core_executable));

      if(path_file_exists(core_executable))
      {
         //Start CORE executable
         strlcpy(libretro_path, core_executable, sizeof(libretro_path));
         RARCH_LOG("Start [%s].\n", libretro_path);
      }
      else
      {
         if (config_file_exists)
         {
            config_file_t * conf = config_file_new(config_path);
            config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
            config_file_free(conf);
            strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
         }

         if (!config_file_exists || !strcmp(libretro_path, ""))
            find_and_set_first_file();
         else
            RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);

         if (!config_file_exists)
         {
            config_file_t *new_conf = config_file_new(NULL);
            config_set_string(new_conf, "libretro_path", libretro_path);
            config_file_write(new_conf, config_path);
            config_file_free(new_conf);
         }
      }
   }

   cellPadEnd();

}
开发者ID:AampApps,项目名称:RetroArch,代码行数:60,代码来源:platform_ps3.c

示例2: salamander_init_settings

static void salamander_init_settings(void)
{
   char tmp_str[512] = {0};
   bool config_file_exists;

   if(!path_file_exists(default_paths.config_path))
   {
      FILE * f;
      config_file_exists = false;
      RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", default_paths.config_path);
      MAKE_DIR(default_paths.port_dir);
      f = fopen(default_paths.config_path, "w");
      fclose(f);
   }
   else
      config_file_exists = true;

   //try to find CORE executable
   char core_executable[1024];
   snprintf(core_executable, sizeof(core_executable), "%s/CORE.dol", default_paths.core_dir);

   if(path_file_exists(core_executable))
   {
      //Start CORE executable
      snprintf(default_paths.libretro_path, sizeof(default_paths.libretro_path), core_executable);
      RARCH_LOG("Start [%s].\n", default_paths.libretro_path);
   }
   else
   {
      if(config_file_exists)
      {
         config_file_t * conf = config_file_new(default_paths.config_path);
         config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
         config_file_free(conf);
         snprintf(default_paths.libretro_path, sizeof(default_paths.libretro_path), tmp_str);
      }

      if(!config_file_exists || !strcmp(default_paths.libretro_path, ""))
         find_and_set_first_file();
      else
      {
         RARCH_LOG("Start [%s] found in retroarch.cfg.\n", default_paths.libretro_path);
      }

      if (!config_file_exists)
      {
         config_file_t *new_conf = config_file_new(NULL);
         config_set_string(new_conf, "libretro_path", default_paths.libretro_path);
         config_file_write(new_conf, default_paths.config_path);
         config_file_free(new_conf);
      }
   }
}
开发者ID:Jalle19,项目名称:RetroArch,代码行数:53,代码来源:platform_gx.c

示例3: salamander_init

static void salamander_init(void)
{
   char tmp_str[512] = {0};
   bool config_file_exists;

   if (path_file_exists(config_path))
      config_file_exists = true;

   //try to find CORE executable
   char core_executable[1024];
   fill_pathname_join(core_executable, default_paths.core_dir, "CORE.dol", sizeof(core_executable));

   if(path_file_exists(core_executable))
   {
      //Start CORE executable
      strlcpy(libretro_path, core_executable, sizeof(libretro_path));
      RARCH_LOG("Start [%s].\n", libretro_path);
   }
   else
   {
      if(config_file_exists)
      {
         config_file_t * conf = config_file_new(config_path);
         if (!conf) // stupid libfat bug or something; somtimes it says the file is there when it doesn't
            config_file_exists = false;
         else
         {
            config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
            config_file_free(conf);
            strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
         }
      }

      if(!config_file_exists || !strcmp(libretro_path, ""))
         find_and_set_first_file();
      else
      {
         RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);
      }

      if (!config_file_exists)
      {
         config_file_t *new_conf = config_file_new(NULL);
         config_set_string(new_conf, "libretro_path", libretro_path);
         config_file_write(new_conf, config_path);
         config_file_free(new_conf);
      }
   }
}
开发者ID:AampApps,项目名称:RetroArch,代码行数:49,代码来源:platform_gx.c

示例4: libretro_install_core

// Rename core filename executable to a more sane name.
static bool libretro_install_core(const char *path_prefix,
      const char *core_exe_path)
{
   char old_path[PATH_MAX], new_path[PATH_MAX];

   libretro_get_current_core_pathname(old_path, sizeof(old_path));

   strlcat(old_path, DEFAULT_EXE_EXT, sizeof(old_path));
   snprintf(new_path, sizeof(new_path), "%s%s", path_prefix, old_path);

   /* If core already exists, we are upgrading the core - 
    * delete existing file first. */
   if (path_file_exists(new_path))
   {
      RARCH_LOG("Removing temporary ROM file: %s.\n", new_path);
      if (remove(new_path) < 0)
         RARCH_ERR("Failed to remove file: %s.\n", new_path);
   }

   /* Now attempt the renaming of the core. */
   RARCH_LOG("Renaming core to: %s.\n", new_path);
   if (rename(core_exe_path, new_path) < 0)
   {
      RARCH_ERR("Failed to rename core.\n");
      return false;
   }

   strlcpy(g_settings.libretro, new_path,
         sizeof(g_settings.libretro));

   return true;
}
开发者ID:MoonlightStudios,项目名称:RetroArch,代码行数:33,代码来源:frontend.c

示例5: core_info_list_update_missing_firmware_internal

static bool core_info_list_update_missing_firmware_internal(
      core_info_list_t *core_info_list,
      const char *core,
      const char *systemdir)
{
   size_t i;
   char path[PATH_MAX_LENGTH] = {0};
   core_info_t          *info = NULL;

   if (!core_info_list || !core)
      return false;

   info = core_info_find_internal(core_info_list, core);

   if (!info)
      return false;

   for (i = 0; i < info->firmware_count; i++)
   {
      if (!info->firmware[i].path)
         continue;

      fill_pathname_join(path, systemdir,
            info->firmware[i].path, sizeof(path));
      info->firmware[i].missing = !path_file_exists(path);
   }

   return true;
}
开发者ID:KitoHo,项目名称:RetroArch,代码行数:29,代码来源:core_info.c

示例6: glui_context_reset

static void glui_context_reset(void *data)
{
   char bgpath[PATH_MAX];
   glui_handle_t *glui = NULL;
   menu_handle_t *menu = (menu_handle_t*)data;
   gl_t *gl = (gl_t*)driver_video_resolve(NULL);
    
   (void)gl;

   driver.gfx_use_rgba = true;

   if (!menu)
      return;

   glui = (glui_handle_t*)menu->userdata;

   if (!glui)
      return;

   fill_pathname_join(bgpath, g_settings.assets_directory,
         "glui", sizeof(bgpath));

   fill_pathname_join(bgpath, bgpath, "bg.png", sizeof(bgpath));

   if (path_file_exists(bgpath))
      glui->bg = glui_png_texture_load(bgpath);

   printf("%d\n", glui->bg);
}
开发者ID:SunGuo,项目名称:RetroArch,代码行数:29,代码来源:glui.c

示例7: XuiListGetCurSel

HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{
   char path[PATH_MAX];
   process_input_ret = 0;

   if(hObjPressed == m_menulist)
   {
      int index = XuiListGetCurSel(m_menulist, NULL);
      wcstombs(str_buffer, (const wchar_t *)XuiListGetText(m_menulist, index), sizeof(str_buffer));
      if (path_file_exists(rgui->browser->list->elems[index].data))
      {
         fill_pathname_join(g_extern.fullpath, rgui->browser->current_dir.directory_path, str_buffer, sizeof(g_extern.fullpath));
         g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
         process_input_ret = -1;
      }
      else if(rgui->browser->list->elems[index].attr.b)
      {
         fill_pathname_join(path, rgui->browser->current_dir.directory_path, str_buffer, sizeof(path));
         filebrowser_set_root_and_ext(rgui->browser, rgui->info.valid_extensions, path);
         filebrowser_fetch_directory_entries(RGUI_ACTION_OK);
      }
   }

   bHandled = TRUE;

   return 0;
}
开发者ID:AbelFlos,项目名称:RetroArch,代码行数:27,代码来源:rmenu_xui.cpp

示例8: defined

static const char *font_renderer_stb_get_default_font(void)
{
   static const char *paths[] = {
#if defined(_WIN32)
      "C:\\Windows\\Fonts\\consola.ttf",
      "C:\\Windows\\Fonts\\verdana.ttf",
#elif defined(__APPLE__)
      "/Library/Fonts/Microsoft/Candara.ttf",
      "/Library/Fonts/Verdana.ttf",
      "/Library/Fonts/Tahoma.ttf",
#elif defined(__ANDROID_API__)
      "/system/fonts/DroidSansMono.ttf",
      "/system/fonts/CutiveMono.ttf",
      "/system/fonts/DroidSans.ttf",
#else
      "/usr/share/fonts/TTF/DejaVuSansMono.ttf",
      "/usr/share/fonts/TTF/DejaVuSans.ttf",
      "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf",
      "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
      "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf",
      "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
#endif
      "osd-font.ttf",
      NULL
   };

   const char **p;

   for (p = paths; *p; ++p)
      if (path_file_exists(*p))
         return *p;

   return NULL;
}
开发者ID:rglass01,项目名称:RetroArch,代码行数:34,代码来源:stb.c

示例9: core_info_get_display_name

bool core_info_get_display_name(const char *path, char *s, size_t len)
{
   char       *core_name = NULL;
   config_file_t *conf   = NULL;

   if (!path_file_exists(path))
      return false;

   conf = config_file_new(path);

   if (!conf)
      goto error;

   config_get_string(conf, "corename",
         &core_name);

   config_file_free(conf);

   if (!core_name)
      goto error;

   if (!conf)
      return false;

   strlcpy(s, core_name, len);

   return true;

error:
   return false;
}
开发者ID:netux79,项目名称:RAvideoFixes,代码行数:31,代码来源:core_info.c

示例10: event_load_auto_state

static void event_load_auto_state(void)
{
   bool ret;
   char msg[PATH_MAX_LENGTH]                 = {0};
   char savestate_name_auto[PATH_MAX_LENGTH] = {0};
   settings_t *settings = config_get_ptr();
   global_t   *global   = global_get_ptr();

#ifdef HAVE_NETPLAY
   if (global->netplay_enable && !global->netplay_is_spectate)
      return;
#endif

   if (!settings->savestate_auto_load)
      return;

   fill_pathname_noext(savestate_name_auto, global->savestate_name,
         ".auto", sizeof(savestate_name_auto));

   if (!path_file_exists(savestate_name_auto))
      return;

   ret = load_state(savestate_name_auto);

   RARCH_LOG("Found auto savestate in: %s\n", savestate_name_auto);

   snprintf(msg, sizeof(msg), "Auto-loading savestate from \"%s\" %s.",
         savestate_name_auto, ret ? "succeeded" : "failed");
   rarch_main_msg_queue_push(msg, 1, 180, false);
   RARCH_LOG("%s\n", msg);
}
开发者ID:hbfelizzola,项目名称:RetroArch,代码行数:31,代码来源:command_event.c

示例11: menu_content_find_first_core

/**
 * menu_content_find_first_core:
 * @core_info            : Core info list handle.
 * @dir                  : Directory. Gets joined with @path.
 * @path                 : Path. Gets joined with @dir.
 * @menu_label           : Label identifier of menu setting.
 * @s                    : Deferred core path. Will be filled in
 *                         by function.
 * @len                  : Size of @s.
 *
 * Gets deferred core.
 *
 * Returns: false if there are multiple deferred cores and a
 * selection needs to be made from a list, otherwise
 * returns true and fills in @s with path to core.
 **/
static bool menu_content_find_first_core(void *data)
{
   char new_core_path[PATH_MAX_LENGTH];
   const core_info_t *info                 = NULL;
   size_t supported                        = 0;
   menu_content_ctx_defer_info_t *def_info = 
      (menu_content_ctx_defer_info_t *)data;
   core_info_list_t *core_info             = 
      (core_info_list_t*)def_info->data;
   uint32_t menu_label_hash                = 
      menu_hash_calculate(def_info->menu_label);

   if (     !string_is_empty(def_info->dir) 
         && !string_is_empty(def_info->path))
      fill_pathname_join(def_info->s, 
            def_info->dir, def_info->path, def_info->len);

#ifdef HAVE_COMPRESSION
   if (path_is_compressed_file(def_info->dir))
   {
      /* In case of a compressed archive, we have to join with a hash */
      /* We are going to write at the position of dir: */
      retro_assert(strlen(def_info->dir) < strlen(def_info->s));
      def_info->s[strlen(def_info->dir)] = '#';
   }
#endif

   if (core_info)
      core_info_list_get_supported_cores(core_info,
            def_info->s, &info,
            &supported);

   /* We started the menu with 'Load Content', we are 
    * going to use the current core to load this. */
   if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
   {
      core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, (void*)&info);
      if (info)
      {
         RARCH_LOG("Use the current core (%s) to load this content...\n",
               info->path);
         supported = 1;
      }
   }

   /* There are multiple deferred cores and a
    * selection needs to be made from a list, return 0. */
   if (supported != 1)
      return false;

    if (info)
      strlcpy(new_core_path, info->path, sizeof(new_core_path));

   runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, def_info->s);

   if (path_file_exists(new_core_path))
      runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);

   return true;
}
开发者ID:spielvan,项目名称:RetroArch,代码行数:76,代码来源:menu_content.c

示例12: convert_wchar_to_char

HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{
   char path[PATH_MAX];

   if(hObjPressed == m_romlist)
   {
      int index = m_romlist.GetCurSel();
      convert_wchar_to_char(str_buffer, (const wchar_t *)m_romlist.GetText(index), sizeof(str_buffer));
      if(path_file_exists(tmp_browser.current_dir.list->elems[index].data))
      {
         snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
         rarch_settings_change(S_RETURN_TO_LAUNCHER);
      }
      else if(tmp_browser.current_dir.list->elems[index].attr.b)
      {
         snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
         filebrowser_set_root_and_ext(&tmp_browser, "xex|XEX", path);
         uint64_t action = (1ULL << RMENU_DEVICE_NAV_B);
         filebrowser_fetch_directory_entries(&tmp_browser, action, &m_romlist, &m_rompathtitle);
      }
   }

   bHandled = TRUE;
   return 0;
}
开发者ID:barnhilltrckn,项目名称:RetroArch-1,代码行数:25,代码来源:menu.cpp

示例13: core_info_list_get_missing_firmware

void core_info_list_get_missing_firmware(core_info_list_t *core_info_list,
      const char *core, const char *systemdir,
      const core_info_firmware_t **firmware, size_t *num_firmware)
{
   size_t i;
   char path[PATH_MAX];
   core_info_t *info = NULL;

   if (!core_info_list || !core)
      return;

   *firmware = NULL;
   *num_firmware = 0;

   if (!(info = find_core_info(core_info_list, core)))
      return;

   *firmware = info->firmware;

   for (i = 1; i < info->firmware_count; i++)
   {
      fill_pathname_join(path, systemdir, info->firmware[i].path, sizeof(path));
      info->firmware[i].missing = !path_file_exists(path);
      *num_firmware += info->firmware[i].missing;
   }

   qsort(info->firmware, info->firmware_count, sizeof(*info->firmware), core_info_firmware_cmp);
}
开发者ID:FriskyBandit,项目名称:RetroArch,代码行数:28,代码来源:core_info.c

示例14: action_ok_remap_file_save_game

static int action_ok_remap_file_save_game(const char *path,
      const char *label, unsigned type, size_t idx)
{
   global_t *global = global_get_ptr();
   settings_t *settings = config_get_ptr();

   const char *core_name;
   core_name = global->system.info.library_name;

   const char *game_name;
   game_name = path_basename(global->basename);

   char directory[PATH_MAX_LENGTH];
   char file[PATH_MAX_LENGTH];

   fill_pathname_join(directory,settings->input_remapping_directory,core_name,PATH_MAX_LENGTH);
   fill_pathname_join(file,core_name,game_name,PATH_MAX_LENGTH);

   if(!path_file_exists(directory))
       path_mkdir(directory);

   if(input_remapping_save_file(file))
      rarch_main_msg_queue_push("Remap file saved successfully", 1, 100, true);
   else
      rarch_main_msg_queue_push("Error saving remap file", 1, 100, true);

   return 0;
}
开发者ID:beshio,项目名称:RetroArch,代码行数:28,代码来源:menu_entries_cbs_ok.c

示例15: nk_menu_context_reset_textures

static void nk_menu_context_reset_textures(nk_menu_handle_t *nk,
      const char *iconpath)
{
   unsigned i;

   for (i = 0; i < NK_TEXTURE_LAST; i++)
   {
      struct texture_image ti     = {0};
      char path[PATH_MAX_LENGTH]  = {0};

      switch(i)
      {
         case NK_TEXTURE_POINTER:
            fill_pathname_join(path, iconpath,
                  "pointer.png", sizeof(path));
            break;
      }

      if (string_is_empty(path) || !path_file_exists(path))
         continue;

      image_texture_load(&ti, path);
      video_driver_texture_load(&ti,
            TEXTURE_FILTER_MIPMAP_LINEAR, &nk->textures.list[i]);

      image_texture_load(&ti, path);
   }
}
开发者ID:Alexandre-Garcia,项目名称:RetroArch,代码行数:28,代码来源:nuklear.c


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