diff --git a/Knossos.NET/Classes/KnUtils.cs b/Knossos.NET/Classes/KnUtils.cs
index a97a435a..6c25c9c0 100644
--- a/Knossos.NET/Classes/KnUtils.cs
+++ b/Knossos.NET/Classes/KnUtils.cs
@@ -402,12 +402,15 @@ public static void OpenFolder(string path)
///
/// Async directory copy helper method
/// Support optional recursive copy and progressCallback that informs the name of the current file that is being copied
+ /// Supports passing an optional array of extensions to ignore during file copy.
+ /// Files and folders starting with a "." (Unix hidden folder convention) are skipped.
///
///
///
///
///
///
+ ///
///
///
///
@@ -433,6 +436,9 @@ public static async Task CopyDirectoryAsync(string sourceDir, string desti
{
throw new TaskCanceledException();
}
+ //Skip Unix convention hidden files
+ if (file.Name.StartsWith("."))
+ continue;
if (ignoreExtensions == null || !ignoreExtensions.Contains(file.Extension.ToLower()))
{
var targetFilePath = Path.Combine(destinationDir, file.Name);
@@ -452,9 +458,11 @@ public static async Task CopyDirectoryAsync(string sourceDir, string desti
{
throw new TaskCanceledException();
}
-
+ //Skip Unix convention hidden folder too
+ if (subDir.Name.StartsWith("."))
+ continue;
var newDestinationDir = Path.Combine(destinationDir, subDir.Name);
- await CopyDirectoryAsync(subDir.FullName, newDestinationDir, true, cancelSource, progressCallback);
+ await CopyDirectoryAsync(subDir.FullName, newDestinationDir, true, cancelSource, progressCallback, ignoreExtensions);
}
}
diff --git a/Knossos.NET/Models/GlobalSettings.cs b/Knossos.NET/Models/GlobalSettings.cs
index 574e3815..d4f5c506 100644
--- a/Knossos.NET/Models/GlobalSettings.cs
+++ b/Knossos.NET/Models/GlobalSettings.cs
@@ -160,7 +160,7 @@ public StandaloneServerSettings(MultiCfg multiCfg, string id, string version, in
[JsonPropertyName("close_to_tray")]
public bool closeToTray {
get { return _closeToTray; }
- set { if (_closeToTray != value) {
+ set { if (_closeToTray != value) {
_closeToTray = value;
pendingChangesOnAppClose = true;
}
@@ -170,7 +170,10 @@ public bool closeToTray {
public List ignoredLauncherUpdates { get; set; } = new List();
[JsonPropertyName("standalone_server_settings")]
- public StandaloneServerSettings? standaloneServerSettings { get; set;} = null;
+ public StandaloneServerSettings? standaloneServerSettings { get; set; } = null;
+
+ [JsonPropertyName("mod_filecopy_extension_skip")]
+ public List? skipExtensionsModFilecopy { get; set; } = new List() { ".svn", ".github", ".git", ".gitattributes", ".gitignore", ".md" };
/*
* Settings that can wait to be saved at app close so we dont have to call save() all the time
@@ -733,6 +736,7 @@ public void Load()
MainWindowViewModel.Instance?.InstalledModsView?.ResetFilters();
}
standaloneServerSettings = tempSettings.standaloneServerSettings;
+ skipExtensionsModFilecopy = tempSettings.skipExtensionsModFilecopy;
ReadFS2IniValues();
Log.Add(Log.LogSeverity.Information, "GlobalSettings.Load()", "Global settings have been loaded");
diff --git a/Knossos.NET/ViewModels/Templates/Tasks/CreateModVersion.cs b/Knossos.NET/ViewModels/Templates/Tasks/CreateModVersion.cs
index 765f32d7..60029960 100644
--- a/Knossos.NET/ViewModels/Templates/Tasks/CreateModVersion.cs
+++ b/Knossos.NET/ViewModels/Templates/Tasks/CreateModVersion.cs
@@ -4,6 +4,7 @@
using System.IO;
using System.Threading.Tasks;
using System.Threading;
+using System.Linq;
namespace Knossos.NET.ViewModels
{
@@ -59,7 +60,13 @@ public async Task CreateModVersion(Mod oldMod, string newVersion, Cancella
writer.WriteLine("Warning: This token indicates an incomplete folder copy. If this token is present on the next KnossosNET startup this folder WILL BE DELETED.");
}
- await KnUtils.CopyDirectoryAsync(currentDir.FullName, newDir, true, cancellationTokenSource, copyCallback);
+ await KnUtils.CopyDirectoryAsync(
+ currentDir.FullName,
+ newDir,
+ true,
+ cancellationTokenSource,
+ copyCallback,
+ Knossos.globalSettings.skipExtensionsModFilecopy != null && Knossos.globalSettings.skipExtensionsModFilecopy.Any() ? Knossos.globalSettings.skipExtensionsModFilecopy.ToArray() : null);
File.Delete(newDir + Path.DirectorySeparatorChar + "knossos_net_download.token");