diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 0063a2e6..25aa2cd4 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -75,6 +75,8 @@ namespace Vocaluxe.Base #if INSTALLER public static readonly string DataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Vocaluxe"); +#elif LINUX + public static readonly string DataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vocaluxe"); #else public static readonly string DataFolder = ProgramFolder; #endif diff --git a/Vocaluxe/CProgrammHelper.cs b/Vocaluxe/CProgrammHelper.cs index 9f342c90..d25b138e 100644 --- a/Vocaluxe/CProgrammHelper.cs +++ b/Vocaluxe/CProgrammHelper.cs @@ -96,6 +96,23 @@ namespace Vocaluxe return _IsProgramInstalled("Microsoft Visual C++ 2010"); } + private static void _EnsureDataFolderExists() + { + if (!Directory.Exists(CSettings.DataFolder)) { + Directory.CreateDirectory(CSettings.DataFolder); + // copy default profiles to DataFolder instead of adding ProgramFolder to CConfig.ProfileFolders + // because we want to be able to edit them, but might not have permission to write to ProgramFolder + string profilePath = Path.Combine(CSettings.DataFolder, CSettings.FolderNameProfiles); + Directory.CreateDirectory(profilePath); + DirectoryInfo defaultProfileDir = new DirectoryInfo(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameProfiles)); + FileInfo[] files = defaultProfileDir.GetFiles(); + foreach (FileInfo file in files) { + string newPath = Path.Combine(profilePath, file.Name); + file.CopyTo(newPath, false); + } + } + } + public static bool CheckRequirements() { #if WIN @@ -135,6 +152,9 @@ namespace Vocaluxe #endif path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar + path; COSFunctions.AddEnvironmentPath(path); +#if LINUX + _EnsureDataFolderExists(); +#endif } } } \ No newline at end of file diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 6bac885c..43964170 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -85,11 +85,12 @@ namespace Vocaluxe { // Init Log CLog.Init(); - CLog.StartBenchmark("Init Program"); + if (!CProgrammHelper.CheckRequirements()) return; CProgrammHelper.Init(); + CLog.StartBenchmark("Init Program"); CMain.Init(); Application.DoEvents();