Skip to content

Commit 4c613ed

Browse files
committed
26.1.27 Some fix
1 parent 8a572b5 commit 4c613ed

9 files changed

Lines changed: 41 additions & 10 deletions

File tree

Debug/lib/te32.dll

0 Bytes
Binary file not shown.

Debug/lib/te64.dll

0 Bytes
Binary file not shown.

Debug/script/consts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,8 @@ STGM_FAILIFTHERE = 0;
19561956
STGM_NOSNAPSHOT = 0x200000;
19571957
STGM_DIRECT_SWMR = 0x400000;
19581958

1959+
REPLACEFILE_WRITE_THROUGH = 1;
1960+
19591961
if (!window.chrome || !window.alert) {
19601962
if (!window.te) {
19611963
te = external;

Debug/script/options.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@
8888
<label>Input</label><br>
8989
<label><input type="checkbox" id="!Conf_NoAutocomplete">@ieframe.dll,-12806[Autocomplete]</label>
9090
<br><br>
91+
<label>@sdclt.exe,-1156[Back Up Files]</label> (*.bak)<br>
92+
<input type="text" name="Conf_Backup" style="display: none">
93+
<label><input type="radio" name="Conf_Backup_" id="Conf_Backup=0" onclick="SetRadio(this)">@fde.dll,-905[Leave in Existing Location]</label><br>
94+
<label><input type="radio" name="Conf_Backup_" id="Conf_Backup=1" onclick="SetRadio(this)">Delete</label><br>
95+
<label><input type="radio" name="Conf_Backup_" id="Conf_Backup=2" onclick="SetRadio(this)">@shell32.dll,-37384[-8964]</label><br>
96+
<br>
9197
<div class="block">
9298
<button name="ButtonInitConfig" onclick="InitConfig(this);">Initialize config folder</button>
9399
<br>

Debug/script/sync.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ g_.arError = api.CreateObject("Array");
6969

7070
AboutTE = function (n) {
7171
if (n == 0) {
72-
return te.Version < 20251220 ? te.Version : 20251231;
72+
return te.Version < 20260127 ? te.Version : 20260127;
7373
}
7474
if (n == 1) {
7575
const v = AboutTE(0);
@@ -696,6 +696,16 @@ LoadXml = function (filename, nGroup) {
696696
--g_.LockUpdate;
697697
}
698698

699+
SafeReplaceFile = function (path) {
700+
if (api.ReplaceFile(path, path + ".tmp", path + ".bak", REPLACEFILE_WRITE_THROUGH)) {
701+
if (te.Data.Conf_Backup) {
702+
DeleteItem(path + ".bak", te.Data.Conf_Backup == 1 ? 0 : FOF_ALLOWUNDO | FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI);
703+
}
704+
} else {
705+
DeleteItem(path + ".tmp");
706+
}
707+
}
708+
699709
SaveXmlTC = function (Ctrl, xml, nGroup) {
700710
if (!Ctrl) {
701711
return;
@@ -789,7 +799,9 @@ SaveConfigXML = function (filename) {
789799

790800
MainWindow.RunEvent1("SaveConfig", xml);
791801
try {
792-
xml.save(PathUnquoteSpaces(filename));
802+
const path = PathUnquoteSpaces(filename);
803+
xml.save(path + ".tmp");
804+
SafeReplaceFile(path);
793805
} catch (e) {
794806
if (e.number != E_ACCESSDENIED) {
795807
ShowError(e, [GetText("Save"), filename].join(": "));
@@ -823,7 +835,9 @@ SaveXml = function (filename) {
823835

824836
MainWindow.RunEvent1("SaveWindow", xml);
825837
try {
826-
xml.save(ExtractPath(te, filename));
838+
const path = ExtractPath(te, filename);
839+
xml.save(path + ".tmp");
840+
SafeReplaceFile(path);
827841
} catch (e) {
828842
if (e.number != E_ACCESSDENIED) {
829843
ShowError(e, [GetText("Save"), filename].join(": "));
@@ -3006,7 +3020,8 @@ MakeMenus = function (hMenu, menus, arMenu, items, Ctrl, pt, nMin, arItem, bTran
30063020
SaveXmlEx = function (fn, xml) {
30073021
try {
30083022
fn = BuildPath(te.Data.DataFolder, "config\\" + fn);
3009-
xml.save(fn);
3023+
xml.save(fn + ".tmp");
3024+
SafeReplaceFile(fn);
30103025
} catch (e) {
30113026
if (e.number != E_ACCESSDENIED) {
30123027
ShowError(e, [GetText("Save"), fn].join(": "));

Debug/script/sync1.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ RefreshEx = function (FV, tm, df) {
849849
FV.Data.AccessTime = "!";
850850
FV.Data.pathChk = FV.FolderItem.Path;
851851
api.PathIsDirectory(function (hr, FV, Path) {
852-
if (FV.Data) {
852+
if (FV.Data && FV.FolderItem) {
853853
FV.Data.AccessTime = new Date().getTime();
854854
FV.Data.pathChk = void 0;
855855
if (Path == FV.FolderItem.Path) {
@@ -3527,7 +3527,7 @@ CreateUpdater = function (arg) {
35273527
api.FindClose(hFind);
35283528

35293529
if (arDel.length) {
3530-
api.SHFileOperation(FO_DELETE, arDel, null, FOF_SILENT | FOF_NOCONFIRMATION, false);
3530+
DeleteItem(arDel);
35313531
}
35323532
const ppid = api.Memory("DWORD");
35333533
api.GetWindowThreadProcessId(te.hwnd, ppid);

Debug/script/ui.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,11 +1444,13 @@ CreateXmlUI = function (bRoot) {
14441444

14451445
SaveXmlExUI = async function (fn, xml) {
14461446
fn = BuildPath(await te.Data.DataFolder, "config\\" + fn);
1447-
const r = (await WriteTextFile(fn, window.XMLSerializer ? new XMLSerializer().serializeToString(xml) : xml.xml) || "").split("\t");
1447+
const r = (await WriteTextFile(fn + ".tmp", window.XMLSerializer ? new XMLSerializer().serializeToString(xml) : xml.xml) || "").split("\t");
14481448
if (r[0] && r[0] != E_ACCESSDENIED) {
14491449
const e = await api.CreateObject("Object");
14501450
e.message = r[1];
14511451
ShowError(e, [await GetText("Save"), fn].join(": "));
1452+
} else {
1453+
SafeReplaceFile(fn);
14521454
}
14531455
}
14541456

TE/Resource.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#define VER_D 8
1515
#else
1616
//Version(DLL)
17-
#define VER_Y 25
18-
#define VER_M 12
19-
#define VER_D 20
17+
#define VER_Y 26
18+
#define VER_M 1
19+
#define VER_D 27
2020
#endif
2121

2222
//Icon

TE/api.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,6 +3083,11 @@ VOID teApiResetEvent(int nArg, teParam *param, DISPPARAMS *pDispParams, VARIANT
30833083
teSetBool(pVarResult, ResetEvent(param[0].handle));
30843084
}
30853085

3086+
VOID teApiReplaceFile(int nArg, teParam *param, DISPPARAMS *pDispParams, VARIANT *pVarResult)
3087+
{
3088+
teSetBool(pVarResult, ReplaceFile(param[0].lpcwstr, param[1].lpcwstr, param[2].lpcwstr, param[3].dword, NULL, NULL));
3089+
}
3090+
30863091
VOID teApiRoundRect(int nArg, teParam *param, DISPPARAMS *pDispParams, VARIANT *pVarResult)
30873092
{
30883093
teSetBool(pVarResult, RoundRect(param[0].hdc, param[1].intVal, param[2].intVal, param[3].intVal, param[4].intVal, param[5].intVal, param[6].intVal));
@@ -4342,6 +4347,7 @@ TEDispatchApi dispAPI[] = {
43424347
{ 2, -1, -1, -1, "ReleaseDC", teApiReleaseDC },
43434348
{ 3, -1, -1, -1, "RemoveMenu", teApiRemoveMenu },
43444349
{ 1, -1, -1, -1, "ResetEvent", teApiResetEvent },
4350+
{ 4, 0, 1, 2, "ReplaceFile", teApiReplaceFile },
43454351
{ 7, -1, -1, -1, "RoundRect", teApiRoundRect },
43464352
{ 6, 4, -1, -1, "RunDLL", teApiRunDLL },
43474353
{ 2, -1, -1, -1, "ScreenToClient", teApiScreenToClient },

0 commit comments

Comments
 (0)