Skip to content

Commit 61112dd

Browse files
committed
Fix problem with remaining ".app" directories on Mac OSX
1 parent a5da108 commit 61112dd

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Assets/PatchKit Patcher/Scripts/AppUpdater/Commands/InstallDiffCommand.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using PatchKit.Unity.Patcher.Cancellation;
77
using PatchKit.Unity.Patcher.Debug;
88
using PatchKit.Unity.Patcher.Status;
9+
using PatchKit.Unity.Utilities;
910

1011
namespace PatchKit.Unity.Patcher.AppUpdater.Commands
1112
{
@@ -112,6 +113,7 @@ public override void Execute(CancellationToken cancellationToken)
112113
ProcessAddedFiles(packageDirPath, cancellationToken);
113114
ProcessRemovedFiles(cancellationToken);
114115
ProcessModifiedFiles(packageDirPath, cancellationToken);
116+
DeleteEmptyMacAppDirectories();
115117
}
116118
finally
117119
{
@@ -253,6 +255,31 @@ private void ProcessModifiedFiles(string packageDirPath,
253255

254256
_modifiedFilesStatusReporter.OnProgressChanged(1.0);
255257
}
258+
259+
// TODO: Temporary solution for situation when .app directory is not deleted
260+
private void DeleteEmptyMacAppDirectories()
261+
{
262+
if (Platform.IsOSX())
263+
{
264+
DebugLogger.Log("Deleting empty Mac OSX '.app' directories...");
265+
266+
var appDirectories = Directory
267+
.GetFileSystemEntries(_localData.Path)
268+
.Where(s => Directory.Exists(s) &&
269+
s.EndsWith(".app") &&
270+
Directory.GetFiles(s, "*", SearchOption.AllDirectories).Length == 0);
271+
272+
foreach (var dir in appDirectories)
273+
{
274+
if (Directory.Exists(dir))
275+
{
276+
DirectoryOperations.Delete(dir, true);
277+
}
278+
}
279+
280+
DebugLogger.Log("Empty Mac OSX '.app' directories has been deleted.");
281+
}
282+
}
256283

257284
private void PatchFile(string fileName, string packageDirPath)
258285
{

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717
- Moving files after installation instead of copying them
1818
- Fix keys API connection problem
1919
- Fix API cache usage problems
20+
- Fix problem with remaining ".app" directories on Mac OSX
2021

2122
## [3.1.4]
2223
### Fixed

0 commit comments

Comments
 (0)