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
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 9b918f0..fecc032 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -715,11 +715,12 @@
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 @@
#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 @@
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 @@
// 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;
}