소스 검색

FIX: Remove UseConfigInProgramDir from doublecmd.xml

Alexander Koblov 2 년 전
부모
커밋
12dde068bc
1개의 변경된 파일12개의 추가작업 그리고 13개의 파일을 삭제
  1. 12 13
      src/uglobs.pas

+ 12 - 13
src/uglobs.pas

@@ -209,7 +209,8 @@ const
   // 11  - During the last 2-3 years the default font for search result was set in file, not loaded and different visually than was was stored.
   // 12  - Split Behaviours/HeaderFooterSizeFormat to Behaviours/HeaderSizeFormat and Behaviours/FooterSizeFormat
   //       Loading a config prior of version 11 should ignore that setting and keep default.
-  ConfigVersion = 12;
+  // 13 -  Replace Configuration/UseConfigInProgramDir by doublecmd.inf
+  ConfigVersion = 13;
 
   // Configuration related filenames
   sMULTIARC_FILENAME = 'multiarc.ini';
@@ -2231,6 +2232,11 @@ begin
           if gConfig.TryGetValue(gConfig.RootNode, 'Configuration/UseConfigInProgramDir', gUseConfigInProgramDir) then
           begin
             gConfig.DeleteNode(gConfig.RootNode, 'Configuration/UseConfigInProgramDir');
+            if not gUseConfigInProgramDir then
+            begin
+              gConfig.Save;
+              mbDeleteFile(gpGlobalCfgDir + 'doublecmd.inf');
+            end;
           end;
 
           if not gUseConfigInProgramDir then
@@ -2433,18 +2439,6 @@ begin
           mbDeleteFile(gpGlobalCfgDir + 'doublecmd.inf')
       end;
 
-      { Remove location of configuration files from XML}
-      if mbFileAccess(gpGlobalCfgDir + 'doublecmd.xml', fmOpenWrite or fmShareDenyWrite) then
-      begin
-        TmpConfig := TXmlConfig.Create(gpGlobalCfgDir + 'doublecmd.xml', True);
-        try
-          TmpConfig.DeleteNode(TmpConfig.RootNode, 'Configuration/UseConfigInProgramDir');
-          TmpConfig.Save;
-        finally
-          TmpConfig.Free;
-        end;
-      end;
-
       gConfig.FileName := gpCfgDir + 'doublecmd.xml';
     end;
 
@@ -2535,6 +2529,11 @@ begin
     gPreviousVersion:= GetAttr(Root, 'DCVersion', EmptyStr);
     LoadedConfigVersion := GetAttr(Root, 'ConfigVersion', ConfigVersion);
 
+    if (LoadedConfigVersion < 13) then
+    begin
+      DeleteNode(Root, 'Configuration/UseConfigInProgramDir');
+    end;
+
     { Language page }
     gPOFileName := GetValue(Root, 'Language/POFileName', gPOFileName);