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
This commit is contained in:
Dees Troy
2015-01-22 15:21:27 -06:00
committed by Ethan Yonker
parent d9ff3c5dd0
commit 3454ade92d
11 changed files with 49 additions and 38 deletions
+7 -5
View File
@@ -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;
}