static void task_push_content_update_firmware_status( content_information_ctx_t *content_ctx) { char s[PATH_MAX_LENGTH]; core_info_ctx_firmware_t firmware_info; core_info_t *core_info = NULL; core_info_get_current_core(&core_info); if (!core_info) return; firmware_info.path = core_info->path; if (!string_is_empty(content_ctx->directory_system)) firmware_info.directory.system = content_ctx->directory_system; else { strlcpy(s, path_get(RARCH_PATH_CONTENT) ,sizeof(s)); path_basedir_wrapper(s); firmware_info.directory.system = s; } RARCH_LOG("Updating firmware status for: %s on %s\n", core_info->path, firmware_info.directory.system); core_info_list_update_missing_firmware(&firmware_info); }
void path_set_basename(const char *path) { char *dst = NULL; path_set(RARCH_PATH_CONTENT, path); path_set(RARCH_PATH_BASENAME, path); #ifdef HAVE_COMPRESSION /* Removing extension is a bit tricky for compressed files. * Basename means: * /file/to/path/game.extension should be: * /file/to/path/game * * Two things to consider here are: /file/to/path/ is expected * to be a directory and "game" is a single file. This is used for * states and srm default paths. * * For compressed files we have: * * /file/to/path/comp.7z#game.extension and * /file/to/path/comp.7z#folder/game.extension * * The choice I take here is: * /file/to/path/game as basename. We might end up in a writable * directory then and the name of srm and states are meaningful. * */ path_basedir_wrapper(path_main_basename); fill_pathname_dir(path_main_basename, path, "", sizeof(path_main_basename)); #endif if ((dst = strrchr(path_main_basename, '.'))) *dst = '\0'; }
static void update_firmware_status(void) { char s[PATH_MAX_LENGTH]; core_info_ctx_firmware_t firmware_info; core_info_t *core_info = NULL; settings_t *settings = config_get_ptr(); core_info_get_current_core(&core_info); if (!core_info || !settings) return; firmware_info.path = core_info->path; if (!string_is_empty(settings->directory.system)) firmware_info.directory.system = settings->directory.system; else { strlcpy(s, path_get(RARCH_PATH_CONTENT) ,sizeof(s)); path_basedir_wrapper(s); firmware_info.directory.system = s; } RARCH_LOG("Updating firmware status for: %s on %s\n", core_info->path, firmware_info.directory.system); core_info_list_update_missing_firmware(&firmware_info); }
void fill_pathname_abbreviate_special(char *out_path, const char *in_path, size_t size) { #if !defined(RARCH_CONSOLE) unsigned i; const char *candidates[3]; const char *notations[3]; char application_dir[PATH_MAX_LENGTH]; const char *home = getenv("HOME"); application_dir[0] = '\0'; /* application_dir could be zero-string. Safeguard against this. * * Keep application dir in front of home, moving app dir to a * new location inside home would break otherwise. */ /* ugly hack - use application_dir pointer before filling it in. C89 reasons */ candidates[0] = application_dir; candidates[1] = home; candidates[2] = NULL; notations [0] = ":"; notations [1] = "~"; notations [2] = NULL; fill_pathname_application_path(application_dir, sizeof(application_dir)); path_basedir_wrapper(application_dir); for (i = 0; candidates[i]; i++) { if (!string_is_empty(candidates[i]) && strstr(in_path, candidates[i]) == in_path) { size_t src_size = strlcpy(out_path, notations[i], size); retro_assert(src_size < size); out_path += src_size; size -= src_size; in_path += strlen(candidates[i]); if (!path_char_is_slash(*in_path)) { retro_assert(strlcpy(out_path, path_default_slash(), size) < size); out_path++; size--; } break; /* Don't allow more abbrevs to take place. */ } } #endif retro_assert(strlcpy(out_path, in_path, size) < size); }
void fill_pathname_expand_special(char *out_path, const char *in_path, size_t size) { #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) if (*in_path == '~') { const char *home = getenv("HOME"); if (home) { size_t src_size = strlcpy(out_path, home, size); retro_assert(src_size < size); out_path += src_size; size -= src_size; in_path++; } } else if ((in_path[0] == ':') && ( (in_path[1] == '/') #ifdef _WIN32 || (in_path[1] == '\\') #endif ) ) { size_t src_size; char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); application_dir[0] = '\0'; fill_pathname_application_path(application_dir, PATH_MAX_LENGTH * sizeof(char)); path_basedir_wrapper(application_dir); src_size = strlcpy(out_path, application_dir, size); retro_assert(src_size < size); free(application_dir); out_path += src_size; size -= src_size; in_path += 2; } #endif retro_assert(strlcpy(out_path, in_path, size) < size); }