Save version to cache

This commit is contained in:
Dees_Troy
2013-01-17 21:42:14 +00:00
parent 4fc0024c53
commit 1c1ac44eaa
2 changed files with 13 additions and 4 deletions
+10 -4
View File
@@ -831,15 +831,21 @@ int DataManager::GetMagicValue(const string varName, string& value)
}
void DataManager::Output_Version(void) {
string Path, Command;
string Path;
char version[255];
Path = DataManager::GetSettingsStoragePath();
if (!PartitionManager.Mount_By_Path(Path, false)) {
if (!PartitionManager.Mount_By_Path("/cache", false)) {
LOGI("Unable to mount '%s' to write version number.\n", Path.c_str());
return;
}
Path += "/TWRP/.version";
if (!TWFunc::Path_Exists("/cache/recovery/.")) {
LOGI("Recreating /cache/recovery folder.\n");
if (mkdir("/cache/recovery", S_IRWXU | S_IRWXG | S_IWGRP | S_IXGRP) != 0) {
LOGE("DataManager::Output_Version -- Unable to make /cache/recovery\n");
return;
}
}
Path = "/cache/recovery/.version";
if (TWFunc::Path_Exists(Path)) {
unlink(Path.c_str());
}
+3
View File
@@ -832,6 +832,9 @@ bool TWPartition::Wipe(string New_File_System) {
}
#endif
if (Mount_Point == "/cache")
DataManager::Output_Version();
if (TWFunc::Path_Exists("/.layout_version") && Mount(false))
TWFunc::copy_file("/.layout_version", Layout_Filename, 0600);