Fixed clients being unable to receive files if the download folder doesn't exist ツ

This commit is contained in:
Regalis
2017-04-06 20:13:44 +03:00
parent 4ad373294c
commit dc73880cd9

View File

@@ -207,6 +207,19 @@ namespace Barotrauma.Networking
DebugConsole.Log(" Sequence channel: " + inc.SequenceChannel);
}
if (!Directory.Exists(downloadFolder))
{
try
{
Directory.CreateDirectory(downloadFolder);
}
catch (Exception e)
{
DebugConsole.ThrowError("Could not start a file transfer: failed to create the folder \""+downloadFolder+"\".", e);
return;
}
}
var newTransfer = new FileTransferIn(inc.SenderConnection, Path.Combine(downloadFolder, fileName), (FileTransferType)fileType);
newTransfer.SequenceChannel = inc.SequenceChannel;
newTransfer.Status = FileTransferStatus.Receiving;