diff options
author | Justin Clark-Casey (justincc) | 2012-10-24 03:08:58 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-24 03:08:58 +0100 |
commit | f76dceb90b5a76a7b6a5243c9032996c007c0cf5 (patch) | |
tree | 19b99bef42c0c56febfad10835027d3c6f101619 /OpenSim/Region | |
parent | Add "dump object uuid" console command. This allows any object in the scene ... (diff) | |
download | opensim-SC-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.zip opensim-SC-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.tar.gz opensim-SC-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.tar.bz2 opensim-SC-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.tar.xz |
Get "save oar" and "save iar" to tell you in a more friendly manner if the filename to save already exists, rather than exception throwing.
Also changes ConsoleUtil.CheckFileExists to CheckFileDoesNotExist() since this is more meaningful in the context, even though it does result in double negatives.
Diffstat (limited to '')
4 files changed, 19 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index cf87010..afe1200 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -35,6 +35,7 @@ using Nini.Config; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
@@ -209,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
209 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 210 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
210 | Dictionary<string, object> options) | 211 | Dictionary<string, object> options) |
211 | { | 212 | { |
213 | if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) | ||
214 | return false; | ||
215 | |||
212 | if (m_scenes.Count > 0) | 216 | if (m_scenes.Count > 0) |
213 | { | 217 | { |
214 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 218 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2a87dc2..970487a 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -32,6 +32,8 @@ using System.Reflection; | |||
32 | using log4net; | 32 | using log4net; |
33 | using NDesk.Options; | 33 | using NDesk.Options; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
37 | 39 | ||
@@ -117,7 +119,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
117 | // | 119 | // |
118 | // foreach (string param in mainParams) | 120 | // foreach (string param in mainParams) |
119 | // m_log.DebugFormat("GOT PARAM [{0}]", param); | 121 | // m_log.DebugFormat("GOT PARAM [{0}]", param); |
120 | 122 | ||
121 | if (mainParams.Count > 2) | 123 | if (mainParams.Count > 2) |
122 | { | 124 | { |
123 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); | 125 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); |
@@ -150,14 +152,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
150 | 152 | ||
151 | List<string> mainParams = ops.Parse(cmdparams); | 153 | List<string> mainParams = ops.Parse(cmdparams); |
152 | 154 | ||
155 | string path; | ||
153 | if (mainParams.Count > 2) | 156 | if (mainParams.Count > 2) |
154 | { | 157 | path = mainParams[2]; |
155 | ArchiveRegion(mainParams[2], options); | ||
156 | } | ||
157 | else | 158 | else |
158 | { | 159 | path = DEFAULT_OAR_BACKUP_FILENAME; |
159 | ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, options); | 160 | |
160 | } | 161 | if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, path)) |
162 | return; | ||
163 | |||
164 | ArchiveRegion(path, options); | ||
161 | } | 165 | } |
162 | 166 | ||
163 | public void ArchiveRegion(string savePath, Dictionary<string, object> options) | 167 | public void ArchiveRegion(string savePath, Dictionary<string, object> options) |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 41a1afd..f0a35ad 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -485,11 +485,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
485 | 485 | ||
486 | string fileName = string.Format("{0}.xml", objectUuid); | 486 | string fileName = string.Format("{0}.xml", objectUuid); |
487 | 487 | ||
488 | if (File.Exists(fileName)) | 488 | if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) |
489 | { | ||
490 | m_console.OutputFormat("File {0} already exists. Please move or remove it.", fileName); | ||
491 | return; | 489 | return; |
492 | } | ||
493 | 490 | ||
494 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) | 491 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) |
495 | { | 492 | { |
diff --git a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs index 41ec14f..7639c6c 100644 --- a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs | |||
@@ -127,6 +127,9 @@ namespace OpenSim.Region.OptionalModules.Asset | |||
127 | } | 127 | } |
128 | 128 | ||
129 | string fileName = rawAssetId; | 129 | string fileName = rawAssetId; |
130 | |||
131 | if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName)) | ||
132 | return; | ||
130 | 133 | ||
131 | using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) | 134 | using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) |
132 | { | 135 | { |