diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index f4260c6..0b012a6 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.4.569")] -[assembly: AssemblyFileVersion("3.0.4.569")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.4.570")] +[assembly: AssemblyFileVersion("3.0.4.570")] \ No newline at end of file diff --git a/Core/Settings.cs b/Core/Settings.cs index a2ead8f..e5f69f7 100644 --- a/Core/Settings.cs +++ b/Core/Settings.cs @@ -832,7 +832,9 @@ namespace ScrewTurn.Wiki { /// The namespace (null for the root). /// The path of the theme. public static string GetThemePath(string nspace) { - return ThemesDirectoryName + "/" + GetTheme(nspace) + "/"; + string path = ThemesDirectoryName + "/" + GetTheme(nspace) + "/"; + if(!Directory.Exists(path)) return ThemesDirectoryName + "/Default/"; + else return path; } /// diff --git a/Core/Tools.cs b/Core/Tools.cs index b93adcb..4bf6588 100644 --- a/Core/Tools.cs +++ b/Core/Tools.cs @@ -25,18 +25,20 @@ namespace ScrewTurn.Wiki { /// The namespace (null for the root). /// The includes. public static string GetIncludes(string nspace) { - string theme = Settings.GetTheme(nspace); string themePath = Settings.GetThemePath(nspace); StringBuilder result = new StringBuilder(300); result.Append(GetJavaScriptIncludes()); - string[] css = Directory.GetFiles(Settings.ThemesDirectory + theme, "*.css"); + string themeDir = Settings.ThemesDirectory + Settings.GetTheme(nspace); + if(!Directory.Exists(themeDir)) themeDir = Settings.ThemesDirectory + "Default"; + + string[] css = Directory.GetFiles(themeDir, "*.css"); string firstChunk; for(int i = 0; i < css.Length; i++) { if(Path.GetFileName(css[i]).IndexOf("_") != -1) { - firstChunk = Path.GetFileName(css[i]).Substring(0, Path.GetFileName(css[i]).IndexOf("_")).ToLower(CultureInfo.CurrentCulture); + firstChunk = Path.GetFileName(css[i]).Substring(0, Path.GetFileName(css[i]).IndexOf("_")).ToLowerInvariant(); if(firstChunk.Equals("screen") || firstChunk.Equals("print") || firstChunk.Equals("all") || firstChunk.Equals("aural") || firstChunk.Equals("braille") || firstChunk.Equals("embossed") || firstChunk.Equals("handheld") || firstChunk.Equals("projection") || firstChunk.Equals("tty") || firstChunk.Equals("tv")) { @@ -51,21 +53,20 @@ namespace ScrewTurn.Wiki { } } - string customEditorCss = Path.Combine(Settings.ThemesDirectory, theme); - customEditorCss = Path.Combine(customEditorCss, "Editor.css"); - if(File.Exists(customEditorCss)) result.AppendFormat(@"" + "\n", theme); + string customEditorCss = Path.Combine(themeDir, "Editor.css"); + if(File.Exists(customEditorCss)) result.AppendFormat(@"" + "\n", themePath); else result.Append(@"" + "\n"); // OpenSearch result.AppendFormat(@"", Settings.MainUrl, Settings.WikiTitle + " - Search"); - string[] js = Directory.GetFiles(Settings.ThemesDirectory + theme, "*.js"); + string[] js = Directory.GetFiles(themeDir, "*.js"); for(int i = 0; i < js.Length; i++) { result.Append(@"" + "\n"); } - string[] icons = Directory.GetFiles(Settings.ThemesDirectory + theme, "Icon.*"); + string[] icons = Directory.GetFiles(themeDir, "Icon.*"); if(icons.Length > 0) { result.Append(@"