int move_dex(const char *src, const char *dst) { char src_dex[PKG_PATH_MAX]; char dst_dex[PKG_PATH_MAX]; if (!is_valid_apk_path(src)) return -1; if (!is_valid_apk_path(dst)) return -1; if (create_cache_path(src_dex, src)) return -1; if (create_cache_path(dst_dex, dst)) return -1; LOGI("move %s -> %s\n", src_dex, dst_dex); if (rename(src_dex, dst_dex) < 0) { return -1; } else { return 0; } }
int rm_dex(const char *path) { char dex_path[PKG_PATH_MAX]; if (!is_valid_apk_path(path)) return -1; if (create_cache_path(dex_path, path)) return -1; LOGI("unlink %s\n", dex_path); if (unlink(dex_path) < 0) { return -1; } else { return 0; } }
int rm_dex(const char *path) { char dex_path[PKG_PATH_MAX]; if (!is_valid_apk_path(path)) return -1; if (create_cache_path(dex_path, path)) return -1; LOGI("unlink %s\n", dex_path); if (unlink(dex_path) < 0) { LOGE("Couldn't unlink %s: %s\n", dex_path, strerror(errno)); return -1; } else { return 0; } }