aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-24 02:30:21 +0000
committerJustin Clark-Casey (justincc)2012-03-24 02:30:43 +0000
commitf53c6b25940a51fce208b3dae21fad49ab8d1efe (patch)
treebc45b18c20ce72e3f215ffd98c3cb6d27061ba3b /OpenSim/Region
parentGive feedback when "terrain save-tile" is not successfully invoked. (diff)
downloadopensim-SC_OLD-f53c6b25940a51fce208b3dae21fad49ab8d1efe.zip
opensim-SC_OLD-f53c6b25940a51fce208b3dae21fad49ab8d1efe.tar.gz
opensim-SC_OLD-f53c6b25940a51fce208b3dae21fad49ab8d1efe.tar.bz2
opensim-SC_OLD-f53c6b25940a51fce208b3dae21fad49ab8d1efe.tar.xz
Use system provided temporary file in "terrain save-tile" to avoid problems with drive letters on windows
Thanks to Garmin Kawaguichi for picking up on this and providing an initial solution (which I adapted).
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
index 21a9999..58925fd 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
@@ -132,13 +132,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
132 { 132 {
133 // We need to do this because: 133 // We need to do this because:
134 // "Saving the image to the same file it was constructed from is not allowed and throws an exception." 134 // "Saving the image to the same file it was constructed from is not allowed and throws an exception."
135 string tempName = offsetX + "_ " + offsetY + "_" + filename; 135 string tempName = Path.GetTempFileName();
136 136
137 Bitmap entireBitmap = null; 137 Bitmap entireBitmap = null;
138 Bitmap thisBitmap = null; 138 Bitmap thisBitmap = null;
139 if (File.Exists(filename)) 139 if (File.Exists(filename))
140 { 140 {
141 File.Copy(filename, tempName); 141 File.Copy(filename, tempName, true);
142 entireBitmap = new Bitmap(tempName); 142 entireBitmap = new Bitmap(tempName);
143 if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) 143 if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
144 { 144 {
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
152 } 152 }
153 153
154 thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); 154 thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
155 Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); 155// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
156 for (int x = 0; x < regionSizeX; x++) 156 for (int x = 0; x < regionSizeX; x++)
157 for (int y = 0; y < regionSizeY; y++) 157 for (int y = 0; y < regionSizeY; y++)
158 entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); 158 entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));