summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-11-26 16:58:41 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-11-26 16:58:41 -0500
commitfc9043c1ba80bc7d593ca9f00659b866d99e2251 (patch)
treed0afbed26bbec1b31a83a6af6c990dfd38541b2e /src
parent1aa4098a510ce0f82e7ea7abc24e31e4f5f27225 (diff)
downloadSMAPI-fc9043c1ba80bc7d593ca9f00659b866d99e2251.tar.gz
SMAPI-fc9043c1ba80bc7d593ca9f00659b866d99e2251.tar.bz2
SMAPI-fc9043c1ba80bc7d593ca9f00659b866d99e2251.zip
fix rare installer error on Mac due to generated mcs file (#394)
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI.Installer/InteractiveInstaller.cs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index b5c2735b..83f353ae 100644
--- a/src/SMAPI.Installer/InteractiveInstaller.cs
+++ b/src/SMAPI.Installer/InteractiveInstaller.cs
@@ -296,7 +296,7 @@ namespace StardewModdingApi.Installer
{
// copy SMAPI files to game dir
this.PrintDebug("Adding SMAPI files...");
- foreach (FileInfo sourceFile in packageDir.EnumerateFiles())
+ foreach (FileInfo sourceFile in packageDir.EnumerateFiles().Where(this.ShouldCopyFile))
{
string targetPath = Path.Combine(installDir.FullName, sourceFile.Name);
this.InteractivelyDelete(targetPath);
@@ -338,7 +338,7 @@ namespace StardewModdingApi.Installer
targetDir.Create();
// copy files
- foreach (FileInfo sourceFile in sourceDir.EnumerateFiles())
+ foreach (FileInfo sourceFile in sourceDir.EnumerateFiles().Where(this.ShouldCopyFile))
sourceFile.CopyTo(Path.Combine(targetDir.FullName, sourceFile.Name));
}
}
@@ -684,7 +684,7 @@ namespace StardewModdingApi.Installer
this.PrintDebug(" Support for mods here was dropped in SMAPI 1.0 (it was never officially supported).");
// move mods if no conflicts (else warn)
- foreach (FileSystemInfo entry in modDir.EnumerateFileSystemInfos())
+ foreach (FileSystemInfo entry in modDir.EnumerateFileSystemInfos().Where(this.ShouldCopyFile))
{
// get type
bool isDir = entry is DirectoryInfo;
@@ -718,7 +718,7 @@ namespace StardewModdingApi.Installer
else
{
this.PrintDebug(" Deleted empty directory.");
- modDir.Delete();
+ modDir.Delete(recursive: true);
}
}
@@ -741,11 +741,22 @@ namespace StardewModdingApi.Installer
Directory.CreateDirectory(newPath);
DirectoryInfo directory = (DirectoryInfo)entry;
- foreach (FileSystemInfo child in directory.EnumerateFileSystemInfos())
+ foreach (FileSystemInfo child in directory.EnumerateFileSystemInfos().Where(this.ShouldCopyFile))
this.Move(child, Path.Combine(newPath, child.Name));
- directory.Delete();
+ directory.Delete(recursive: true);
}
}
+
+ /// <summary>Get whether a file should be copied when moving a folder.</summary>
+ /// <param name="file">The file info.</param>
+ private bool ShouldCopyFile(FileSystemInfo file)
+ {
+ // ignore Mac symlink
+ if (file is FileInfo && file.Name == "mcs")
+ return false;
+
+ return true;
+ }
}
}