From 5e0fa2a7587ebf70482e32e4227813c9b820f484 Mon Sep 17 00:00:00 2001
From: onefang
Date: Thu, 18 Jul 2019 05:16:15 +1000
Subject: OpenSim changed the way FSAssets directory structure works by
 default, sort that out.

Otherwise updating from 0.8 to 0.9 with FSAssets will fail to find new
assets.
---
 OpenSim/Services/FSAssetService/FSAssetService.cs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs
index 4d47589..27b04f7 100644
--- a/OpenSim/Services/FSAssetService/FSAssetService.cs
+++ b/OpenSim/Services/FSAssetService/FSAssetService.cs
@@ -186,7 +186,18 @@ namespace OpenSim.Services.FSAssetService
                 throw new Exception("Configuration error");
             }
 
+	    // OSGrid format is /3/3/, OpenSims default format is /2/2/2/4/.  Try to figure out which we have.
+	    List<string> dirs = new List<string>(Directory.EnumerateDirectories(m_FSBase));
+	    foreach (var dir in dirs)
+	    {
+		if (3 == dir.Substring(dir.LastIndexOf(Path.DirectorySeparatorChar) + 1).Length)
+		{
+		    m_useOsgridFormat = true;
+		    break;
+		}
+	    }
             m_useOsgridFormat = assetConfig.GetBoolean("UseOsgridFormat", m_useOsgridFormat);
+            m_log.InfoFormat("[FSASSETS]: UseOsgridFormat is {0}", m_useOsgridFormat);
 
             // Default is to show stats to retain original behaviour
             m_showStats = assetConfig.GetBoolean("ShowConsoleStats", m_showStats);
-- 
cgit v1.1