Changeset - 2e8a10efff43
[Not reviewed]
default
0 1 0
Jason Maltzen (jmaltzen) - 9 years ago 2015-12-31 05:53:03
jason.maltzen@unsanctioned.net
Move the check for template directory before creating profile folder.
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
PlayerProfile.cs
Show inline comments
...
 
@@ -105,36 +105,36 @@ namespace DesertPaintLab
 
                {
 
                    if (recipe.IsValid)
 
                    {
 
                        ++count;
 
                    }
 
                }
 
                return count;
 
            }
 
        }
 
		
 
		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();
 

 
			foreach (FileInfo file in templateFiles)
 
			{
 
                string destFile = System.IO.Path.Combine(directory, file.Name);
 
				System.IO.File.Copy(file.FullName, destFile, true);
 
                if (!File.Exists(destFile))
 
                {
 
                    LastError = "Failed to copy template file " + file.Name + ".";
 
                    return false;
 
                }					
0 comments (0 inline, 0 general)