From c10167bb91a9f712b507e1391f19cad8f605c728 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 7 May 2020 11:05:37 +0100 Subject: [PATCH] Throw exception if ContentFolder doesn't exist or is empty --- Facepunch.Steamworks/Structs/UgcEditor.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Facepunch.Steamworks/Structs/UgcEditor.cs b/Facepunch.Steamworks/Structs/UgcEditor.cs index 5ac9cf7..21251b1 100644 --- a/Facepunch.Steamworks/Structs/UgcEditor.cs +++ b/Facepunch.Steamworks/Structs/UgcEditor.cs @@ -96,6 +96,19 @@ namespace Steamworks.Ugc if ( consumerAppId == 0 ) consumerAppId = SteamClient.AppId; + // + // Checks + // + if ( ContentFolder != null ) + { + if ( !System.IO.Directory.Exists( ContentFolder.FullName ) ) + throw new System.Exception( $"UgcEditor - Content Folder doesn't exist ({ContentFolder.FullName})" ); + + if ( !ContentFolder.EnumerateFiles( "*", System.IO.SearchOption.AllDirectories ).Any() ) + throw new System.Exception( $"UgcEditor - Content Folder is empty" ); + } + + // // Item Create //