fetcher git: check if git info directory exists before writing to it. Fixes #934

This commit is contained in:
Hylke Bons 2012-08-27 13:54:22 +01:00
parent 65f02bba90
commit f6dc8fb3bb

View file

@ -333,8 +333,13 @@ namespace SparkleLib.Git {
// Add a .gitignore file to the repo
private void InstallExcludeRules ()
{
string git_info_path = new string [] { TargetFolder, ".git", "info" }.Combine ();
if (!Directory.Exists (git_info_path))
Directory.CreateDirectory (git_info_path);
string exclude_rules = string.Join (Environment.NewLine, ExcludeRules);
string exclude_rules_file_path = new string [] { TargetFolder, ".git", "info", "exclude" }.Combine ();
string exclude_rules_file_path = new string [] { git_info_path, "exclude" }.Combine ();
File.WriteAllText (exclude_rules_file_path, exclude_rules);
}