Skip to content

Commit 763fc94

Browse files
authored
Merge pull request #37 from CandyCoded/hotfix/prevent-overriding-gitignore
[hotfix] Prevent overriding gitignore if file exists.
2 parents af3900a + c9c4172 commit 763fc94

File tree

1 file changed

+10
-1
lines changed
  • Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor

1 file changed

+10
-1
lines changed

Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor/GitIgnore.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ public static class GitIgnore
1818
public static async Task Create(string directory)
1919
{
2020

21+
var path = Path.Combine(directory, FILENAME);
22+
23+
if (File.Exists(path))
24+
{
25+
26+
return;
27+
28+
}
29+
2130
var request = WebRequest.Create(URL);
2231

2332
var response = await request.GetResponseAsync();
@@ -29,7 +38,7 @@ public static async Task Create(string directory)
2938

3039
await stream.CopyToAsync(content);
3140

32-
File.WriteAllBytes(Path.Combine(directory, FILENAME), content.ToArray());
41+
File.WriteAllBytes(path, content.ToArray());
3342

3443
}
3544

0 commit comments

Comments
 (0)