Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit d958c5a

Browse files
Fix updater #80 - Create new folders on update.
1 parent 7ac96dd commit d958c5a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Deploy/SpcodeUpdater/Program.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,23 @@ private static void Worker(object arg)
5353

5454
using (var archive = ZipFile.OpenRead(zipInfo.FullName))
5555
{
56-
// Dont override the sourcemod files
57-
var files = archive.Entries.Where(e => !e.FullName.StartsWith(@"sourcepawn\"));
58-
foreach (var file in files)
56+
foreach (var entry in archive.Entries)
5957
{
60-
file.ExtractToFile(file.FullName, true);
58+
// Dont override the sourcemod files
59+
if (!entry.FullName.StartsWith(@"sourcepawn\"))
60+
{
61+
// Get File directory
62+
var dirBuffer = Path.GetDirectoryName(entry.FullName);
63+
64+
// Create directory if not empty
65+
if (!string.IsNullOrEmpty(dirBuffer))
66+
{
67+
Directory.CreateDirectory(dirBuffer);
68+
}
69+
70+
// Now we can safly extact the file.
71+
entry.ExtractToFile(entry.FullName, true);
72+
}
6173
}
6274
}
6375

0 commit comments

Comments
 (0)