Introduce UseOsgridFormat config to select the OSGrid specific path name

generator
LSLKeyTest
Melanie Thielker 2016-03-05 01:26:28 +01:00
parent 74c2113bce
commit 15b9601393
1 changed files with 24 additions and 19 deletions

View File

@ -76,6 +76,7 @@ namespace OpenSim.Services.FSAssetService
protected int m_missingAssets = 0; protected int m_missingAssets = 0;
protected int m_missingAssetsFS = 0; protected int m_missingAssetsFS = 0;
protected string m_FSBase; protected string m_FSBase;
protected bool m_useOsgridFormat = false;
private static bool m_Initialized; private static bool m_Initialized;
private bool m_MainInstance; private bool m_MainInstance;
@ -183,6 +184,8 @@ namespace OpenSim.Services.FSAssetService
throw new Exception("Configuration error"); throw new Exception("Configuration error");
} }
m_useOsgridFormat = assetConfig.GetBoolean("UseOsgridFormat", m_useOsgridFormat);
if (m_MainInstance) if (m_MainInstance)
{ {
string loader = assetConfig.GetString("DefaultAssetLoader", string.Empty); string loader = assetConfig.GetString("DefaultAssetLoader", string.Empty);
@ -357,25 +360,27 @@ namespace OpenSim.Services.FSAssetService
if (hash == null || hash.Length < 10) if (hash == null || hash.Length < 10)
return "junkyard"; return "junkyard";
/* if (m_useOsgridFormat)
* The code below is the OSGrid code. {
* This should probably become a config option. /*
*/ * The code below is the OSGrid code.
/* */
return Path.Combine(hash.Substring(0, 3), return Path.Combine(hash.Substring(0, 3),
Path.Combine(hash.Substring(3, 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 * The below is what core would normally use.
* above, because the SRAS data is structured * This is modified to work in OSGrid, as seen
* that way. * above, because the SRAS data is structured
*/ * that way.
return Path.Combine(hash.Substring(0, 2), */
Path.Combine(hash.Substring(2, 2), return Path.Combine(hash.Substring(0, 2),
Path.Combine(hash.Substring(4, 2), Path.Combine(hash.Substring(2, 2),
hash.Substring(6, 4)))); Path.Combine(hash.Substring(4, 2),
hash.Substring(6, 4))));
}
} }
private bool AssetExists(string hash) private bool AssetExists(string hash)