From bc0e42af4542a640b55c6b492e23da14e462eafb Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Fri, 24 Feb 2012 07:53:51 +0100 Subject: [PATCH] create needed folders if they not exist --- Vocaluxe/Base/CSettings.cs | 23 ++++++++++++++++++++++- Vocaluxe/Lib/Draw/CDirect3D.cs | 4 +--- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 4 +--- Vocaluxe/Lib/Draw/COpenGL.cs | 4 +--- Vocaluxe/Program.cs | 1 + 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 14366d44..3fe7b0f6 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Text; namespace Vocaluxe.Base @@ -93,7 +94,7 @@ namespace Vocaluxe.Base public static bool TabNavigation = false; public const float BackgroundMusicFadeTime = 0.5f; - + public static string GetVersionText() { string sVersion = "v" + iVersionMajor.ToString() + "." + @@ -140,5 +141,25 @@ namespace Vocaluxe.Base { MouseMoveDiffMin = 3; } + + public static void CreateFolders() + { + List Folders = new List(); + + Folders.Add(sFolderCover); + Folders.Add(sFolderFonts); + Folders.Add(sFolderProfiles); + Folders.Add(sFolderSongs); + Folders.Add(sFolderScreenshots); + Folders.Add(sFolderBackgroundMusic); + Folders.Add(sFolderSounds); + + foreach (string folder in Folders) + { + string path = Path.Combine(Environment.CurrentDirectory, folder); + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + } + } } } diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 0715d792..851b3028 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -461,9 +461,7 @@ namespace Vocaluxe.Lib.Draw { string file = "Screenshot_"; string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots); - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - + int i = 0; while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".bmp"))) i++; diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 6b64e1fc..254763d9 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -300,9 +300,7 @@ namespace Vocaluxe.Lib.Draw { string file = "Screenshot_"; string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots); - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - + int i = 0; while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".png"))) i++; diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 88f8cb18..9644122f 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -556,9 +556,7 @@ namespace Vocaluxe.Lib.Draw { string file = "Screenshot_"; string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots); - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - + int i = 0; while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".bmp"))) i++; diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index aa7a536c..f7fb9602 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -33,6 +33,7 @@ namespace Vocaluxe // Init Log CLog.Init(); + CSettings.CreateFolders(); Application.DoEvents(); // Init Language