diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs
index 5e0185e..03b8dd7 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.572")]
-[assembly: AssemblyFileVersion("3.0.4.572")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.0.4.573")]
+[assembly: AssemblyFileVersion("3.0.4.573")]
\ No newline at end of file
diff --git a/Core/ProviderBase.cs b/Core/ProviderBase.cs
index 706738b..2baea16 100644
--- a/Core/ProviderBase.cs
+++ b/Core/ProviderBase.cs
@@ -12,33 +12,13 @@ namespace ScrewTurn.Wiki {
///
public abstract class ProviderBase {
- private object _syncLock = new object();
-
- private bool _dataDirectoryAlreadyRead = false;
- private string _dataDirectory = null;
-
- ///
- /// Sets the data directory.
- ///
- /// The data directory.
- public void SetDataDirectory(string dataDirectory) {
- lock(_syncLock) {
- if(_dataDirectoryAlreadyRead) throw new InvalidOperationException("Cannot set data directory when it's already been read");
- _dataDirectory = dataDirectory;
- }
- }
-
///
/// Gets the data directory.
///
/// The host object.
/// The data directory.
protected string GetDataDirectory(IHostV30 host) {
- lock(_syncLock) {
- _dataDirectoryAlreadyRead = true;
- if(string.IsNullOrEmpty(_dataDirectory)) return host.GetSettingValue(SettingName.PublicDirectory);
- else return _dataDirectory;
- }
+ return host.GetSettingValue(SettingName.PublicDirectory);
}
}
diff --git a/Core/Settings.cs b/Core/Settings.cs
index e5f69f7..b5618f8 100644
--- a/Core/Settings.cs
+++ b/Core/Settings.cs
@@ -22,6 +22,12 @@ namespace ScrewTurn.Wiki {
private static string version = null;
+ ///
+ /// A value indicating whether the public directory can still be overridden.
+ ///
+ internal static bool CanOverridePublicDirectory = true;
+ private static string _overriddenPublicDirectory = null;
+
///
/// Gets the settings storage provider.
///
@@ -152,11 +158,23 @@ namespace ScrewTurn.Wiki {
get { return System.Web.HttpRuntime.AppDomainAppPath; }
}
+ ///
+ /// Overrides the public directory, unless it's too late to do that.
+ ///
+ /// The full path.
+ internal static void OverridePublicDirectory(string fullPath) {
+ if(!CanOverridePublicDirectory) throw new InvalidOperationException("Cannot override public directory - that can only be done during Settings Storage Provider initialization");
+
+ _overriddenPublicDirectory = fullPath;
+ }
+
///
/// Gets the Public Directory of the Wiki.
///
public static string PublicDirectory {
get {
+ if(!string.IsNullOrEmpty(_overriddenPublicDirectory)) return _overriddenPublicDirectory;
+
string pubDirName = PublicDirectoryName;
if(Path.IsPathRooted(pubDirName)) return pubDirName;
else {
@@ -170,7 +188,7 @@ namespace ScrewTurn.Wiki {
///
/// Gets the Public Directory Name (without the full Path) of the Wiki.
///
- public static string PublicDirectoryName {
+ private static string PublicDirectoryName {
get {
string dir = WebConfigurationManager.AppSettings["PublicDirectory"];
if(string.IsNullOrEmpty(dir)) throw new InvalidConfigurationException("PublicDirectory cannot be empty or null");
diff --git a/Core/StartupTools.cs b/Core/StartupTools.cs
index 6b57ba4..a1ba0ff 100644
--- a/Core/StartupTools.cs
+++ b/Core/StartupTools.cs
@@ -69,6 +69,8 @@ namespace ScrewTurn.Wiki {
ssp.Init(Host.Instance, GetSettingsStorageProviderConfiguration());
Collectors.SettingsProvider = ssp;
+ Settings.CanOverridePublicDirectory = false;
+
if(!(ssp is SettingsStorageProvider)) {
// Update DLLs from public\Plugins
UpdateDllsIntoSettingsProvider(ssp, ProviderLoader.SettingsStorageProviderAssemblyName);