Skip to content

Commit

Permalink
Merge pull request #961 from dlamkins/dev
Browse files Browse the repository at this point in the history
Fixed self update for certain zip files.
  • Loading branch information
dlamkins authored Apr 18, 2024
2 parents b26c7c0 + 412d659 commit edfd3d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Blish HUD/GameServices/Overlay/SelfUpdater/SelfUpdateUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ private static void HandleUpdate(string unpackPath) {

var applicationDir = Directory.GetCurrentDirectory();

var rootDirs = unpacker.Entries.Where(entry => string.IsNullOrWhiteSpace(entry.Name) && entry.FullName.IndexOf('/') == entry.FullName.Length - 1);
var rootDirs = unpacker.Entries
.Select(entry => entry.FullName.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries))
.Where(parts => parts.Length > 1)
.Select(parts => parts[0] + "/")
.Distinct()
.ToList();
var allFiles = unpacker.Entries.Where(entry => !string.IsNullOrWhiteSpace(entry.Name) && !string.Equals(entry.Name, FILE_EXE));
var rootFiles = allFiles.Where(entry => !entry.FullName.Contains("/"));

foreach (var dir in rootDirs) {
string dirPath = Path.Combine(applicationDir, dir.FullName);

foreach (var dirPath in rootDirs) {
if (Directory.Exists(dirPath)) {
Directory.Delete(dirPath, true);
}
Expand Down

0 comments on commit edfd3d7

Please sign in to comment.