[fetcher] Fix InstallConfiguration method

This commit is contained in:
Hylke Bons 2011-03-12 17:53:49 +00:00
parent 116a29839c
commit 5da5926407

View file

@ -83,7 +83,7 @@ namespace SparkleLib {
} else {
InstallUserInfo ();
InstallConfiguration ();
InstallExcludeRules ();
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Repository cloned");
@ -101,30 +101,32 @@ namespace SparkleLib {
}
// Install the user's name and email into
// the newly cloned repository
private void InstallUserInfo ()
{
private void InstallConfiguration ()
{
string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config");
string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config");
if (File.Exists (global_config_file_path)) {
if (File.Exists (global_config_file_path)) {
StreamReader reader = new StreamReader (global_config_file_path);
string user_info = reader.ReadToEnd ();
reader.Close ();
StreamReader reader = new StreamReader (global_config_file_path);
string user_info = reader.ReadToEnd ();
reader.Close ();
string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config");
string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config");
TextWriter writer = File.AppendText (repo_config_file_path);
writer.WriteLine (user_info);
writer.Close ();
string config = String.Join ("\n", File.ReadAllLines (repo_config_file_path));
config = config.Replace ("ignorecase = true", "ignorecase = false");
config += Environment.NewLine + user_info;
SparkleHelpers.DebugInfo ("Config", "Added user info to '" + repo_config_file_path + "'");
TextWriter writer = new StreamWriter (repo_config_file_path);
writer.WriteLine (config);
writer.Close ();
}
SparkleHelpers.DebugInfo ("Config", "Added configuration to '" + repo_config_file_path + "'");
}
}
}
// Add a .gitignore file to the repo