From 1c1ac44eaa6e1e2a84e5da9c95b1d9387e0be1c8 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Thu, 17 Jan 2013 21:42:14 +0000 Subject: Save version to cache --- data.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'data.cpp') diff --git a/data.cpp b/data.cpp index 75d689f0c..3c4e609d4 100644 --- a/data.cpp +++ b/data.cpp @@ -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()); } -- cgit v1.2.3