From 3454ade92db48236057814f0ade5fa45bd57cd62 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Tue, 20 Jan 2015 19:21:04 +0000 Subject: Use /twres instead of /res for theme resources AOSP and other ROM trees now do a rm -rf of the res folder during the ramdisk creation process that removes the TWRP resources. Using /twres instead of /res works around this issue making TWRP more compatible with AOSP and other build trees. Change-Id: I0d4c7e06ca381ac5aa0069b6f2b8c47f7dec49e7 --- gui/gui.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gui/gui.cpp') diff --git a/gui/gui.cpp b/gui/gui.cpp index 9b918f0e7..fecc03278 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -715,11 +715,12 @@ std::string gui_parse_text(string inText) extern "C" int gui_init(void) { gr_init(); + std::string curtain_path = TWRES "images/curtain.jpg"; - if (res_create_surface("/res/images/curtain.jpg", &gCurtain)) + if (res_create_surface(curtain_path.c_str(), &gCurtain)) { printf - ("Unable to locate '/res/images/curtain.jpg'\nDid you set a DEVICE_RESOLUTION in your config files?\n"); + ("Unable to locate '%s'\nDid you set a DEVICE_RESOLUTION in your config files?\n", curtain_path.c_str()); return -1; } @@ -734,9 +735,10 @@ extern "C" int gui_loadResources(void) #ifndef TW_OEM_BUILD int check = 0; DataManager::GetValue(TW_IS_ENCRYPTED, check); + if (check) { - if (PageManager::LoadPackage("TWRP", "/res/ui.xml", "decrypt")) + if (PageManager::LoadPackage("TWRP", TWRES "ui.xml", "decrypt")) { LOGERR("Failed to load base packages.\n"); goto error; @@ -771,7 +773,7 @@ extern "C" int gui_loadResources(void) if (check || PageManager::LoadPackage("TWRP", theme_path, "main")) { #endif // ifndef TW_OEM_BUILD - if (PageManager::LoadPackage("TWRP", "/res/ui.xml", "main")) + if (PageManager::LoadPackage("TWRP", TWRES "ui.xml", "main")) { LOGERR("Failed to load base packages.\n"); goto error; @@ -807,7 +809,7 @@ extern "C" int gui_loadCustomResources(void) // There is a custom theme, try to load it if (PageManager::ReloadPackage("TWRP", theme_path)) { // Custom theme failed to load, try to load stock theme - if (PageManager::ReloadPackage("TWRP", "/res/ui.xml")) { + if (PageManager::ReloadPackage("TWRP", TWRES "ui.xml")) { LOGERR("Failed to load base packages.\n"); goto error; } -- cgit v1.2.3