Skip to content

Commit a5a73b7

Browse files
committed
Finalize addition of the GitBash binary path to Windows Path variable
1 parent 2a94ce6 commit a5a73b7

File tree

4 files changed

+82
-52
lines changed

4 files changed

+82
-52
lines changed

GitAutoUpdateGUI/FormMain.cs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private void CheckGitBashPathInWinPath()
113113
private static bool IsInWinPath(string substring)
114114
{
115115
bool result = false;
116-
string winPath = Environment.GetEnvironmentVariable("Path",EnvironmentVariableTarget.Machine);
116+
string winPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
117117
if (winPath != null) result = winPath.Contains(substring);
118118
return result;
119119
}
@@ -651,7 +651,7 @@ private string Translate(string index) // could add (string index, string _curre
651651

652652
return result;
653653
}
654-
654+
655655
private static Control FindFocusedControl(List<Control> container)
656656
{
657657
return container.FirstOrDefault(control => control.Focused);
@@ -995,7 +995,7 @@ private static bool IsInlistView(ListView listView, ListViewItem lviItem, int co
995995

996996
return result;
997997
}
998-
998+
999999
private static bool NotHavingWords(string source, IEnumerable<string> badWords, bool caseSensitive = false)
10001000
{
10011001
bool result = true;
@@ -1021,7 +1021,7 @@ private static bool NotHavingWords(string source, IEnumerable<string> badWords,
10211021
{
10221022
string tmpbadWord = badWord.Trim().ToLower();
10231023
string tmpSource = source.Trim().ToLower();
1024-
if (tmpSource.Contains(tmpbadWord))
1024+
if (tmpSource.Contains(tmpbadWord))
10251025
{
10261026
result = false;
10271027
break;
@@ -1471,12 +1471,12 @@ private void buttonAddGitBinaryToWinPath_Click(object sender, EventArgs e)
14711471
return;
14721472
}
14731473

1474-
winPath += Punctuation.SemiColon + Punctuation.Backslash +
1474+
winPath += Punctuation.SemiColon + Punctuation.Backslash +
14751475
textBoxGitBashBinariesPath.Text.Substring(0, textBoxGitBashBinariesPath.Text.Length - 8);
14761476
#if Debug
14771477
MessageBox.Show("Here is your modifed Windows Path variable: " + winPath);
14781478
#endif
1479-
bool additionSuccessful = false;
1479+
bool additionSuccessful;
14801480
try
14811481
{
14821482
Environment.SetEnvironmentVariable("Path", winPath, EnvironmentVariableTarget.Machine);
@@ -1485,23 +1485,36 @@ private void buttonAddGitBinaryToWinPath_Click(object sender, EventArgs e)
14851485
catch (SecurityException securityException)
14861486
{
14871487
additionSuccessful = false;
1488-
Logger.Add(textBoxLog, Translate("There was a security error, probably lack of rights") + Punctuation.Colon +
1489-
Punctuation.OneSpace + securityException.Message);
1488+
Logger.Add(textBoxLog, Translate("There was a security error") +
1489+
Punctuation.Comma + Punctuation.OneSpace +
1490+
Translate("probably lack of rights") +
1491+
Punctuation.Colon + Punctuation.OneSpace +
1492+
securityException.Message);
14901493
}
14911494
catch (Exception exception)
14921495
{
14931496
additionSuccessful = false;
14941497
Logger.Add(textBoxLog, Translate("There was an error") + Punctuation.Colon +
1495-
Punctuation.OneSpace + exception.Message);
1498+
Punctuation.CrLf + exception.Message);
14961499
}
14971500

14981501
if (additionSuccessful)
14991502
{
1500-
DisplayMessageOk(Translate(""), Translate(""), MessageBoxButtons.OK);
1503+
string message = Translate("The following path") + Punctuation.Colon + Punctuation.CrLf +
1504+
textBoxGitBashBinariesPath.Text.Substring(0, textBoxGitBashBinariesPath.Text.Length - 8) +
1505+
Punctuation.CrLf + Translate("has been added to the Windows Path variable") +
1506+
Punctuation.CrLf + Translate("YOU HAVE TO REBOOT YOUR PC FOR THE VARIABLE TO BE TAKEN INTO EFFECT");
1507+
Logger.Add(textBoxLog, message);
1508+
DisplayMessageOk(message, Translate("Path added"), MessageBoxButtons.OK);
15011509
}
15021510
else
15031511
{
1504-
DisplayMessageOk(Translate(""), Translate(""), MessageBoxButtons.OK);
1512+
string message = Translate("The following path") + Punctuation.Colon + Punctuation.CrLf +
1513+
textBoxGitBashBinariesPath.Text.Substring(0, textBoxGitBashBinariesPath.Text.Length - 8) +
1514+
Punctuation.CrLf + Translate("has not been added to the Windows Path variable") +
1515+
Punctuation.CrLf + Translate("Check with the developer");
1516+
Logger.Add(textBoxLog, message);
1517+
DisplayMessageOk(message, Translate("Error"), MessageBoxButtons.OK);
15051518
}
15061519
}
15071520
}

GitAutoUpdateGUI/Punctuation.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1818
SOFTWARE.
1919
*/
2020
using System;
21+
using System.Text;
2122

2223
namespace Tools
2324
{
@@ -71,5 +72,16 @@ public static string Tabulate(ushort numberOfTabulation = 1)
7172

7273
return result;
7374
}
75+
76+
public static string CreateSentence(params string[] listOfCharacters)
77+
{
78+
StringBuilder result = new StringBuilder();
79+
foreach (string character in listOfCharacters)
80+
{
81+
result.Append(character);
82+
}
83+
84+
return result.ToString();
85+
}
7486
}
7587
}

GitAutoUpdateGUI/Translations.xml

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -479,46 +479,51 @@
479479
<englishValue>error</englishValue>
480480
<frenchValue>erreur</frenchValue>
481481
</term>
482-
<!--<term>
483-
<name></name>
484-
<englishValue></englishValue>
485-
<frenchValue></frenchValue>
486-
</term>-->
487-
<!--<term>
488-
<name></name>
489-
<englishValue></englishValue>
490-
<frenchValue></frenchValue>
491-
</term>-->
492-
<!--<term>
493-
<name></name>
494-
<englishValue></englishValue>
495-
<frenchValue></frenchValue>
496-
</term>-->
497-
<!--<term>
498-
<name></name>
499-
<englishValue></englishValue>
500-
<frenchValue></frenchValue>
501-
</term>-->
502-
<!--<term>
503-
<name></name>
504-
<englishValue></englishValue>
505-
<frenchValue></frenchValue>
506-
</term>-->
507-
<!--<term>
508-
<name></name>
509-
<englishValue></englishValue>
510-
<frenchValue></frenchValue>
511-
</term>-->
512-
<!--<term>
513-
<name></name>
514-
<englishValue></englishValue>
515-
<frenchValue></frenchValue>
516-
</term>-->
517-
<!--<term>
518-
<name></name>
519-
<englishValue></englishValue>
520-
<frenchValue></frenchValue>
521-
</term>-->
482+
<term>
483+
<name>There was a security error</name>
484+
<englishValue>There was a security error</englishValue>
485+
<frenchValue>Il y a eu une erreur de sécurité</frenchValue>
486+
</term>
487+
<term>
488+
<name>probably lack of rights</name>
489+
<englishValue>probably lack of rights</englishValue>
490+
<frenchValue>probablement un manque de droits</frenchValue>
491+
</term>
492+
<term>
493+
<name>There was an error</name>
494+
<englishValue>There was an error</englishValue>
495+
<frenchValue>Il y a eu une erreur</frenchValue>
496+
</term>
497+
<term>
498+
<name>The following path</name>
499+
<englishValue>The following path</englishValue>
500+
<frenchValue>Le chemin suivant</frenchValue>
501+
</term>
502+
<term>
503+
<name>has been added to the Windows Path variable</name>
504+
<englishValue>has been added to the Windows Path variable</englishValue>
505+
<frenchValue>a été ajouté à la variable Path de Windows</frenchValue>
506+
</term>
507+
<term>
508+
<name>has not been added to the Windows Path variable</name>
509+
<englishValue>has not been added to the Windows Path variable</englishValue>
510+
<frenchValue>n'a pas été ajouté à la variable Path de Windows</frenchValue>
511+
</term>
512+
<term>
513+
<name>YOU HAVE TO REBOOT YOUR PC FOR THE VARIABLE TO BE TAKEN INTO EFFECT</name>
514+
<englishValue>YOU HAVE TO REBOOT YOUR PC FOR THE VARIABLE TO BE TAKEN INTO EFFECT</englishValue>
515+
<frenchValue>VOUS DEVEZ REBOOTER VOTRE PC AFIN QUE LA VARIABLE SOIT PRISE EN COMPTE</frenchValue>
516+
</term>
517+
<term>
518+
<name>Path added</name>
519+
<englishValue>Path added</englishValue>
520+
<frenchValue>Chemin ajouté</frenchValue>
521+
</term>
522+
<term>
523+
<name>Check with the developer</name>
524+
<englishValue>Check with the developer</englishValue>
525+
<frenchValue>Contacter le développeur</frenchValue>
526+
</term>
522527
<!--<term>
523528
<name></name>
524529
<englishValue></englishValue>

GitAutoUpdateGUI/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Punctuation" version="1.3.0" targetFramework="net45" />
3+
<package id="Punctuation" version="1.4.0" targetFramework="net45" />
44
</packages>

0 commit comments

Comments
 (0)