diff options
author | Adam Frisby | 2008-12-09 03:06:26 +0000 |
---|---|---|
committer | Adam Frisby | 2008-12-09 03:06:26 +0000 |
commit | 888151833b1b08a6a8686d75a0385232b7fa90e9 (patch) | |
tree | 0507ca2ddf342242561193e027c876e6bcf5bc2d /OpenSim/Framework/Util.cs | |
parent | Remove null checks on structs (diff) | |
download | opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.zip opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.tar.gz opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.tar.bz2 opensim-SC-888151833b1b08a6a8686d75a0385232b7fa90e9.tar.xz |
* Added primitive exception logging capabilities.
* Disabled by default (see OpenSim.ini.example for how to enable)
* Saves exceptions to a folder on disk (default "crashes") when enabled.
* These reports can then be uploaded or posted to help debug an error.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index c1429df..23bdb94 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -560,6 +560,34 @@ namespace OpenSim.Framework | |||
560 | return "."; | 560 | return "."; |
561 | } | 561 | } |
562 | 562 | ||
563 | // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html | ||
564 | public static string GetUniqueFilename(string FileName) | ||
565 | { | ||
566 | int count = 0; | ||
567 | string Name; | ||
568 | |||
569 | if (File.Exists(FileName)) | ||
570 | { | ||
571 | FileInfo f = new FileInfo(FileName); | ||
572 | |||
573 | if (!string.IsNullOrEmpty(f.Extension)) | ||
574 | { | ||
575 | Name = f.FullName.Substring(0, f.FullName.LastIndexOf('.')); | ||
576 | } | ||
577 | else | ||
578 | { | ||
579 | Name = f.FullName; | ||
580 | } | ||
581 | |||
582 | while (File.Exists(FileName)) | ||
583 | { | ||
584 | count++; | ||
585 | FileName = Name + count + f.Extension; | ||
586 | } | ||
587 | } | ||
588 | return FileName; | ||
589 | } | ||
590 | |||
563 | // Nini (config) related Methods | 591 | // Nini (config) related Methods |
564 | public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) | 592 | public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) |
565 | { | 593 | { |