summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-09-27 21:44:01 +0200
committerDees_Troy <dees_troy@teamw.in>2012-09-27 21:44:01 +0200
commit3477d7163e781bc88836fe5c36160d8eb60ea4ac (patch)
treed11921fd6388cb4843f003407a2d2f0488185aac /twrp-functions.cpp
parentCreate symlinks at compile time for busybox (diff)
downloadandroid_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.tar
android_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.tar.gz
android_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.tar.bz2
android_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.tar.lz
android_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.tar.xz
android_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.tar.zst
android_bootable_recovery-3477d7163e781bc88836fe5c36160d8eb60ea4ac.zip
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 28d0ba58e..320001723 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -15,6 +15,7 @@
#include "common.h"
#include "data.hpp"
#include "bootloader.h"
+#include "variables.h"
/* Checks md5 for a path
Return values:
@@ -385,4 +386,29 @@ void TWFunc::check_and_run_script(const char* script_file, const char* display_n
system(script_file);
ui_print("\nFinished running %s script.\n", display_name);
}
+}
+
+void TWFunc::Output_Version(void) {
+ string Path, Command;
+ char version[255];
+
+ Path = DataManager::GetSettingsStoragePath();
+ if (!PartitionManager.Mount_By_Path(Path, false)) {
+ LOGI("Unable to mount '%s' to write version number.\n");
+ return;
+ }
+ Path += "/TWRP/.version";
+ if (Path_Exists(Path)) {
+ Command = "rm -f " + Path;
+ system(Command.c_str());
+ }
+ FILE *fp = fopen(Path.c_str(), "w");
+ if (fp == NULL) {
+ LOGE("Unable to open '%s'.\n", Path.c_str());
+ return;
+ }
+ strcpy(version, TW_VERSION_STR);
+ fwrite(version, sizeof(version[0]), strlen(version) / sizeof(version[0]), fp);
+ fclose(fp);
+ sync();
} \ No newline at end of file