summaryrefslogtreecommitdiff
path: root/tools/build_scripts/fixme.cmd
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-04 17:35:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-04 17:35:32 +0300
commit46fa8c36208281ab2ca0b35d9df966d1b836c592 (patch)
tree5d646020a0ddac4a23895c06fc01e01466f159b0 /tools/build_scripts/fixme.cmd
parentbc90398de24d738ce4ebfb74021b508f7477d685 (diff)
fixme.cmd - a batch file to extract as much data as possible from the broken profile
Diffstat (limited to 'tools/build_scripts/fixme.cmd')
-rw-r--r--tools/build_scripts/fixme.cmd50
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/build_scripts/fixme.cmd b/tools/build_scripts/fixme.cmd
new file mode 100644
index 0000000000..5a4528d29a
--- /dev/null
+++ b/tools/build_scripts/fixme.cmd
@@ -0,0 +1,50 @@
+@echo off
+
+if "%1" == "" (
+ set /A ProfileCount=0
+
+ pushd %~dp0Profiles
+
+ for /D %%i in (*) do (
+ if exist %~dp0Profiles\%%i\%%i.dat (
+ set ProfileName=%%i
+ set /A ProfileCount=%ProfileCount%+1
+ )
+ )
+
+ popd
+
+) else (
+ if not exist %~dp0Profiles\%1\%1.dat (
+ echo Wrong profile name specified: %1
+ goto :eof
+ )
+
+ set ProfileName=%1
+)
+
+echo Backing up %ProfileName%...
+
+set FullProfileName=.\Profiles\%ProfileName%\%ProfileName%.dat
+set TmpFileName=%TEMP%\%ProfileName%.tmp
+
+del "%TmpFileName%" > nul
+
+mdbx_dump.exe -n -a -f "%TmpFileName%" "%FullProfileName%"
+if not exist "%TmpFileName%" (
+ echo Backup failed, exiting
+ goto :eof
+)
+
+mdbx_load.exe -n -f "%TmpFileName%" "%FullProfileName%.tmp"
+if errorlevel 1 (
+ echo Restore failed, exiting
+ goto :eof
+)
+
+del "%FullProfileName%.bak" > nul
+move "%FullProfileName%" "%FullProfileName%.bak"
+move "%FullProfileName%.tmp" "%FullProfileName%"
+
+echo Operation succeeded
+goto :eof