Skip to content

Commit df99e09

Browse files
committed
Prevent overriding gitignore if file exists.
1 parent cfa111e commit df99e09

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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)