本文整理汇总了C++中String8::appendPath方法的典型用法代码示例。如果您正苦于以下问题:C++ String8::appendPath方法的具体用法?C++ String8::appendPath怎么用?C++ String8::appendPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String8
的用法示例。
在下文中一共展示了String8::appendPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: idmap_scan
int idmap_scan(const char *target_package_name, const char *target_apk_path,
const char *idmap_dir, const android::Vector<const char *> *overlay_dirs)
{
String8 filename = String8(idmap_dir);
filename.appendPath("overlays.list");
if (unlink(filename.string()) != 0 && errno != ENOENT) {
return EXIT_FAILURE;
}
SortedVector<Overlay> overlayVector;
const size_t N = overlay_dirs->size();
for (size_t i = 0; i < N; ++i) {
const char *overlay_dir = overlay_dirs->itemAt(i);
DIR *dir = opendir(overlay_dir);
if (dir == NULL) {
return EXIT_FAILURE;
}
struct dirent *dirent;
while ((dirent = readdir(dir)) != NULL) {
struct stat st;
char overlay_apk_path[PATH_MAX + 1];
snprintf(overlay_apk_path, PATH_MAX, "%s/%s", overlay_dir, dirent->d_name);
if (stat(overlay_apk_path, &st) < 0) {
continue;
}
if (!S_ISREG(st.st_mode)) {
continue;
}
int priority = parse_apk(overlay_apk_path, target_package_name);
if (priority < 0) {
continue;
}
String8 idmap_path(idmap_dir);
idmap_path.appendPath(flatten_path(overlay_apk_path + 1));
idmap_path.append("@idmap");
if (idmap_create_path(target_apk_path, overlay_apk_path, idmap_path.string()) != 0) {
ALOGE("error: failed to create idmap for target=%s overlay=%s idmap=%s\n",
target_apk_path, overlay_apk_path, idmap_path.string());
continue;
}
Overlay overlay(String8(overlay_apk_path), idmap_path, priority);
overlayVector.add(overlay);
}
closedir(dir);
}
if (!writePackagesList(filename.string(), overlayVector)) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
示例2: idmap_scan
int idmap_scan(const char *overlay_dir, const char *target_package_name,
const char *target_apk_path, const char *idmap_dir)
{
String8 filename = String8(idmap_dir);
filename.appendPath("overlays.list");
if (unlink(filename.string()) != 0 && errno != ENOENT) {
return EXIT_FAILURE;
}
SortedVector<Overlay> overlayVector;
int res = idmap_scan(overlay_dir, target_package_name, target_apk_path, idmap_dir,
overlayVector);
if (res == EXIT_FAILURE || !writePackagesList(filename.string(), overlayVector)) {
return EXIT_FAILURE;
}
return res;
}