# HG changeset patch # User Jason Maltzen # Date 2015-12-31 05:53:03 # Node ID 2e8a10efff4353b8b3d93844db04db6cccf8fd68 # Parent 8c3f6ec929d6b9fe3a93030581993ba94f3ed238 Move the check for template directory before creating profile folder. diff --git a/PlayerProfile.cs b/PlayerProfile.cs --- a/PlayerProfile.cs +++ b/PlayerProfile.cs @@ -114,18 +114,18 @@ namespace DesertPaintLab public bool Initialize() { - // Create new directory. - System.IO.Directory.CreateDirectory(directory); - - // Copy template files into new directory. - string templatePath = FileUtils.FindApplicationResourceDirectory("template"); - + // Copy template files into new directory. + string templatePath = FileUtils.FindApplicationResourceDirectory("template"); + if (!System.IO.Directory.Exists(templatePath)) { LastError = "Failed to find profile template folder."; return false; } + // Create new directory. + System.IO.Directory.CreateDirectory(directory); + DirectoryInfo di = new DirectoryInfo(templatePath); FileInfo[] templateFiles = di.GetFiles();