From dc49057c8a1cf99590aa3df25d4888d6dea54eaa Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 20:03:00 +0100 Subject: Consistency patch: use Path.Combine() instead of + and eliminate the need for a trailing slash on exports/ --- .../Region/CoreModules/World/Serialiser/SerialiseObjects.cs | 2 +- .../Region/CoreModules/World/Serialiser/SerialiseTerrain.cs | 5 +++-- .../Region/CoreModules/World/Serialiser/SerialiserModule.cs | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index 5067ebd..328fbf0 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser public string WriteToFile(Scene scene, string dir) { - string targetFileName = dir + "objects.xml"; + string targetFileName = Path.Combine(dir, "objects.xml"); SaveSerialisedToFile(targetFileName, scene); diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs index 5cbe66b..c04753d 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs @@ -28,6 +28,7 @@ using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; using OpenSim.Region.Framework.Scenes; +using System.IO; namespace OpenSim.Region.CoreModules.World.Serialiser { @@ -38,7 +39,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser public string WriteToFile(Scene scene, string dir) { ITerrainLoader fileSystemExporter = new RAW32(); - string targetFileName = dir + "heightmap.r32"; + string targetFileName = Path.Combine(dir, "heightmap.r32"); lock (scene.Heightmap) { @@ -50,4 +51,4 @@ namespace OpenSim.Region.CoreModules.World.Serialiser #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 98fe493..04062b0 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser private Commander m_commander = new Commander("export"); private List m_regions = new List(); - private string m_savedir = "exports" + "/"; + private string m_savedir = "exports"; private List m_serialisers = new List(); #region ISharedRegionModule Members @@ -192,14 +192,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser } } - TextWriter regionInfoWriter = new StreamWriter(saveDir + "README.TXT"); + TextWriter regionInfoWriter = new StreamWriter(Path.Combine(saveDir, "README.TXT")); regionInfoWriter.WriteLine("Region Name: " + scene.RegionInfo.RegionName); regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID.ToString()); regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow.ToString()); regionInfoWriter.WriteLine("Serialise Version: 0.1"); regionInfoWriter.Close(); - TextWriter manifestWriter = new StreamWriter(saveDir + "region.manifest"); + TextWriter manifestWriter = new StreamWriter(Path.Combine(saveDir, "region.manifest")); foreach (string line in results) { manifestWriter.WriteLine(line); @@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser if (region.RegionInfo.RegionName == (string) args[0]) { // List results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); - SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); + SerialiseRegion(region, Path.Combine(m_savedir, region.RegionInfo.RegionID.ToString())); } } } @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser foreach (Scene region in m_regions) { // List results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); - SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); + SerialiseRegion(region, Path.Combine(m_savedir, region.RegionInfo.RegionID.ToString())); } } -- cgit v1.1