Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

shellext: favor thg.exe if it is found

Rename DoHgtk to RunDialog for obvious reasons. I'm doing this
hacking on a Mac, so this may not even compile. I think this will
allow us to build a functioning installer, though in the long run
the choice between hgtk.exe and thg.exe should be user configurable.

Changeset 0ffaeff50c81

Parent 002d33cb4923

by Steve Borho

Changes to 2 files · Browse files at 0ffaeff50c81 Showing diff from parent 002d33cb4923 Diff from another changeset...

 
586
587
588
589
 
590
591
592
 
785
786
787
788
 
789
790
791
792
793
 
794
795
796
 
797
798
799
800
801
 
 
 
 
 
 
 
 
802
803
804
 
815
816
817
818
 
819
820
821
 
825
826
827
828
 
829
830
831
832
 
833
834
835
 
837
838
839
840
 
841
842
843
 
845
846
847
848
 
849
850
851
 
586
587
588
 
589
590
591
592
 
785
786
787
 
788
789
790
791
792
 
793
794
795
 
796
797
798
799
800
 
801
802
803
804
805
806
807
808
809
810
811
 
822
823
824
 
825
826
827
828
 
832
833
834
 
835
836
837
838
 
839
840
841
842
 
844
845
846
 
847
848
849
850
 
852
853
854
 
855
856
857
858
@@ -586,7 +586,7 @@
  MenuIdCmdMap::iterator iter = MenuIdMap.find(idCmd);   if (iter != MenuIdMap.end())   { - DoHgtk(iter->second.name); + RunDialog(iter->second.name);   hr = S_OK;   }   else @@ -785,20 +785,27 @@
 }     -void CShellExtCMenu::DoHgtk(const std::string &cmd) +void CShellExtCMenu::RunDialog(const std::string &cmd)  {   std::string dir = GetTHgProgRoot();   if (dir.empty())   { - TDEBUG_TRACE("DoHgtk: THG root is empty"); + TDEBUG_TRACE("RunDialog: THG root is empty");   return;   } - std::string hgcmd = dir + "\\hgtk.exe"; + std::string hgcmd = dir + "\\thg.exe";     WIN32_FIND_DATAA data;   HANDLE hfind = FindFirstFileA(hgcmd.c_str(), &data);   if (hfind == INVALID_HANDLE_VALUE) - hgcmd = dir + "\\hgtk.cmd"; + { + hgcmd = dir + "\\hgtk.exe"; + hfind = FindFirstFileA(hgcmd.c_str(), &data); + if (hfind == INVALID_HANDLE_VALUE) + hgcmd = dir + "\\thg.cmd"; + else + FindClose(hfind); + }   else   FindClose(hfind);   @@ -815,7 +822,7 @@
  }   else   { - TDEBUG_TRACE("***** DoHgtk: can't get cwd"); + TDEBUG_TRACE("***** RunDialog: can't get cwd");   return;   }   @@ -825,11 +832,11 @@
  const std::string tempfile = GetTemporaryFile();   if (tempfile.empty())   { - TDEBUG_TRACE("***** DoHgtk: error: GetTemporaryFile returned empty string"); + TDEBUG_TRACE("***** RunDialog: error: GetTemporaryFile returned empty string");   return;   }   - TDEBUG_TRACE("DoHgtk: temp file = " << tempfile); + TDEBUG_TRACE("RunDialog: temp file = " << tempfile);   HANDLE tempfileHandle = CreateFileA(   tempfile.c_str(), GENERIC_WRITE,   FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 @@ -837,7 +844,7 @@
    if (tempfileHandle == INVALID_HANDLE_VALUE)   { - TDEBUG_TRACE("***** DoHgtk: error: failed to create file " << tempfile); + TDEBUG_TRACE("***** RunDialog: error: failed to create file " << tempfile);   return;   }   @@ -845,7 +852,7 @@
  for (ST i = 0; i < myFiles.size(); i++)   {   DWORD dwWritten; - TDEBUG_TRACE("DoHgtk: temp file adding " << myFiles[i]); + TDEBUG_TRACE("RunDialog: temp file adding " << myFiles[i]);   WriteFile(   tempfileHandle, myFiles[i].c_str(),   static_cast<DWORD>(myFiles[i].size()), &dwWritten, 0
 
13
14
15
16
 
17
18
19
 
13
14
15
 
16
17
18
19
@@ -13,7 +13,7 @@
  std::vector<std::string> myFiles;   std::string myFolder;   - void DoHgtk(const std::string&); + void RunDialog(const std::string&);    public:   explicit CShellExtCMenu(char dummy);