diff options
author | George Hazan <ghazan@miranda.im> | 2018-10-04 17:35:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-10-04 17:35:32 +0300 |
commit | 46fa8c36208281ab2ca0b35d9df966d1b836c592 (patch) | |
tree | 5d646020a0ddac4a23895c06fc01e01466f159b0 /tools | |
parent | bc90398de24d738ce4ebfb74021b508f7477d685 (diff) |
fixme.cmd - a batch file to extract as much data as possible from the broken profile
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt | 1 | ||||
-rw-r--r-- | tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt | 1 | ||||
-rw-r--r-- | tools/build_scripts/bin15/z3_PackArchives.txt | 1 | ||||
-rw-r--r-- | tools/build_scripts/fixme.cmd | 50 | ||||
-rw-r--r-- | tools/build_scripts/z1_ReBuild_Full.bat | 1 | ||||
-rw-r--r-- | tools/build_scripts/z2_PackPluginUpdater.txt | 1 | ||||
-rw-r--r-- | tools/mdbx_dump/src/mdbx_dump.cc | 10 | ||||
-rw-r--r-- | tools/mdbx_load/src/mdbx_load.cc | 2 |
8 files changed, 63 insertions, 4 deletions
diff --git a/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt b/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt index 8d03656f67..1a55b5e8e2 100644 --- a/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt +++ b/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt @@ -1,4 +1,5 @@ hashes.txt +fixme.cmd mdbx_load.exe mdbx_dump.exe miranda32.exe diff --git a/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt b/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt index 8d4227b806..8f62d7c73f 100644 --- a/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt +++ b/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt @@ -1,4 +1,5 @@ hashes.txt +fixme.cmd mdbx_dump.exe mdbx_load.exe miranda64.exe diff --git a/tools/build_scripts/bin15/z3_PackArchives.txt b/tools/build_scripts/bin15/z3_PackArchives.txt index c1729659b6..b9ba06f579 100644 --- a/tools/build_scripts/bin15/z3_PackArchives.txt +++ b/tools/build_scripts/bin15/z3_PackArchives.txt @@ -41,6 +41,7 @@ Libs\api-ms-win-crt-utility-l1-1-0.dll Libs\msvcp140.dll Libs\ucrtbase.dll Libs\vcruntime140.dll +fixme.cmd mirandaboot.ini mdbx_load.exe mdbx_dump.exe 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 diff --git a/tools/build_scripts/z1_ReBuild_Full.bat b/tools/build_scripts/z1_ReBuild_Full.bat index 3c71d673c6..efb4f41caf 100644 --- a/tools/build_scripts/z1_ReBuild_Full.bat +++ b/tools/build_scripts/z1_ReBuild_Full.bat @@ -81,6 +81,7 @@ md "Release%tp%\Plugins\BASS" md "Release%tp%\Plugins\CurrencyRates" md "Release%tp%\Plugins\Weather" +copy /V /Y ..\tools\build_scripts\fixme.cmd "Release%tp%\" copy /V /Y ..\plugins\FavContacts\gadget\favcontacts.gadget "Release%tp%\Gadgets\" copy /V /Y ..\plugins\Nudge\docs\Sounds\*.wav "Release%tp%\Sounds\" copy /V /Y ..\plugins\ListeningTo\listeningto\*.dll "Release%tp%\Plugins\Listeningto\" diff --git a/tools/build_scripts/z2_PackPluginUpdater.txt b/tools/build_scripts/z2_PackPluginUpdater.txt index e1ff9d0649..cd6f6df855 100644 --- a/tools/build_scripts/z2_PackPluginUpdater.txt +++ b/tools/build_scripts/z2_PackPluginUpdater.txt @@ -60,6 +60,7 @@ Plugins\Dummy.dll Plugins\Import.dll Icons\Proto_Dummy.dll Icons\Proto_MetaContacts.dll +fixme.cmd mdbx_load.exe mdbx_dump.exe Libs\FreeImage.mir diff --git a/tools/mdbx_dump/src/mdbx_dump.cc b/tools/mdbx_dump/src/mdbx_dump.cc index 989c7a0d24..e1c0b45e77 100644 --- a/tools/mdbx_dump/src/mdbx_dump.cc +++ b/tools/mdbx_dump/src/mdbx_dump.cc @@ -251,7 +251,7 @@ int main(int argc, char *argv[]) { mdbx_env_set_maxdbs(env, 2); } - rc = mdbx_env_open(env, envname, envflags | MDBX_RDONLY, 0664); + rc = mdbx_env_open(env, envname, envflags | MDBX_EXCLUSIVE | MDBX_RDONLY, 0664); if (rc) { fprintf(stderr, "mdbx_env_open failed, error %d %s\n", rc, mdbx_strerror(rc)); @@ -323,8 +323,12 @@ int main(int argc, char *argv[]) { } else { rc = dumpit(txn, dbi, subname); } - if (rc && rc != MDBX_NOTFOUND) - fprintf(stderr, "%s: %s: %s\n", prog, envname, mdbx_strerror(rc)); + if (rc) { + if (rc != MDBX_NOTFOUND) + fprintf(stderr, "%s: %s: %s\n", prog, envname, mdbx_strerror(rc)); + else + rc = 0; + } mdbx_dbi_close(env, dbi); txn_abort: diff --git a/tools/mdbx_load/src/mdbx_load.cc b/tools/mdbx_load/src/mdbx_load.cc index 5f08504b70..599677a160 100644 --- a/tools/mdbx_load/src/mdbx_load.cc +++ b/tools/mdbx_load/src/mdbx_load.cc @@ -317,7 +317,7 @@ int main(int argc, char *argv[]) { MDBX_cursor *mc = NULL; MDBX_dbi dbi; char *envname = NULL; - int envflags = 0, putflags = 0; + int envflags = MDBX_EXCLUSIVE, putflags = 0; prog = argv[0]; |