From 15b9601393738e3e8622480fe6716350700a00af Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 5 Mar 2016 01:26:28 +0100 Subject: [PATCH] Introduce UseOsgridFormat config to select the OSGrid specific path name generator --- .../Services/FSAssetService/FSAssetService.cs | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs index bf7ddffe75..9ec2d00a57 100644 --- a/OpenSim/Services/FSAssetService/FSAssetService.cs +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs @@ -76,6 +76,7 @@ namespace OpenSim.Services.FSAssetService protected int m_missingAssets = 0; protected int m_missingAssetsFS = 0; protected string m_FSBase; + protected bool m_useOsgridFormat = false; private static bool m_Initialized; private bool m_MainInstance; @@ -183,6 +184,8 @@ namespace OpenSim.Services.FSAssetService throw new Exception("Configuration error"); } + m_useOsgridFormat = assetConfig.GetBoolean("UseOsgridFormat", m_useOsgridFormat); + if (m_MainInstance) { string loader = assetConfig.GetString("DefaultAssetLoader", string.Empty); @@ -357,25 +360,27 @@ namespace OpenSim.Services.FSAssetService if (hash == null || hash.Length < 10) return "junkyard"; - /* - * The code below is the OSGrid code. - * This should probably become a config option. - */ - /* - return Path.Combine(hash.Substring(0, 3), - Path.Combine(hash.Substring(3, 3))); - */ - - /* - * The below is what core would normally use. - * This is modified to work in OSGrid, as seen - * above, because the SRAS data is structured - * that way. - */ - return Path.Combine(hash.Substring(0, 2), - Path.Combine(hash.Substring(2, 2), - Path.Combine(hash.Substring(4, 2), - hash.Substring(6, 4)))); + if (m_useOsgridFormat) + { + /* + * The code below is the OSGrid code. + */ + return Path.Combine(hash.Substring(0, 3), + Path.Combine(hash.Substring(3, 3))); + } + else + { + /* + * The below is what core would normally use. + * This is modified to work in OSGrid, as seen + * above, because the SRAS data is structured + * that way. + */ + return Path.Combine(hash.Substring(0, 2), + Path.Combine(hash.Substring(2, 2), + Path.Combine(hash.Substring(4, 2), + hash.Substring(6, 4)))); + } } private bool AssetExists(string hash)