aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console/ConsoleUtil.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-24 03:08:58 +0100
committerJustin Clark-Casey (justincc)2012-10-24 03:08:58 +0100
commitf76dceb90b5a76a7b6a5243c9032996c007c0cf5 (patch)
tree19b99bef42c0c56febfad10835027d3c6f101619 /OpenSim/Framework/Console/ConsoleUtil.cs
parentAdd "dump object uuid" console command. This allows any object in the scene ... (diff)
downloadopensim-SC_OLD-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.zip
opensim-SC_OLD-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.tar.gz
opensim-SC_OLD-f76dceb90b5a76a7b6a5243c9032996c007c0cf5.tar.bz2
opensim-SC_OLD-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 'OpenSim/Framework/Console/ConsoleUtil.cs')
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
index 5c25ccb..3ebfdf8 100644
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ b/OpenSim/Framework/Console/ConsoleUtil.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using log4net; 33using log4net;
@@ -60,6 +61,24 @@ namespace OpenSim.Framework.Console
60 61
61 public const string VectorSeparator = ","; 62 public const string VectorSeparator = ",";
62 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray(); 63 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
64
65 /// <summary>
66 /// Check if the given file path exists.
67 /// </summary>
68 /// <remarks>If not, warning is printed to the given console.</remarks>
69 /// <returns>true if the file does not exist, false otherwise.</returns>
70 /// <param name='console'></param>
71 /// <param name='path'></param>
72 public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
73 {
74 if (File.Exists(path))
75 {
76 console.OutputFormat("File {0} already exists. Please move or remove it.", path);
77 return false;
78 }
79
80 return true;
81 }
63 82
64 /// <summary> 83 /// <summary>
65 /// Try to parse a console UUID from the console. 84 /// Try to parse a console UUID from the console.