fix mod deploy failing to create subfolders if they don't already exist

This commit is contained in:
Jesse Plamondon-Willard 2017-10-11 15:31:29 -04:00
parent 127b36dedd
commit 3cfc272453
1 changed files with 4 additions and 1 deletions

View File

@ -96,11 +96,14 @@ namespace StardewModdingAPI.ModBuildConfig
/// <param name="modFolderPath">The folder path to create with the mod files.</param> /// <param name="modFolderPath">The folder path to create with the mod files.</param>
private void CreateModFolder(IDictionary<string, FileInfo> files, string modFolderPath) private void CreateModFolder(IDictionary<string, FileInfo> files, string modFolderPath)
{ {
Directory.CreateDirectory(modFolderPath);
foreach (var entry in files) foreach (var entry in files)
{ {
string fromPath = entry.Value.FullName; string fromPath = entry.Value.FullName;
string toPath = Path.Combine(modFolderPath, entry.Key); string toPath = Path.Combine(modFolderPath, entry.Key);
// ReSharper disable once AssignNullToNotNullAttribute -- not applicable in this context
Directory.CreateDirectory(Path.GetDirectoryName(toPath));
File.Copy(fromPath, toPath, overwrite: true); File.Copy(fromPath, toPath, overwrite: true);
} }
} }