aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/Util.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-07-29 07:14:04 +0000
committerAdam Frisby2007-07-29 07:14:04 +0000
commit43507f857bc87fd0843c94b777b72bdf914d792d (patch)
tree5102c75b3c9e97348c22c4f7f3bb094729c2f949 /OpenSim/Framework/General/Util.cs
parent* Applying issue#230 - Avatar stuck at region edge (Thanks Babblefrog!) (diff)
downloadopensim-SC_OLD-43507f857bc87fd0843c94b777b72bdf914d792d.zip
opensim-SC_OLD-43507f857bc87fd0843c94b777b72bdf914d792d.tar.gz
opensim-SC_OLD-43507f857bc87fd0843c94b777b72bdf914d792d.tar.bz2
opensim-SC_OLD-43507f857bc87fd0843c94b777b72bdf914d792d.tar.xz
* Added new compatibility functions to Util
* IsEnvironmentSupported() - returns whether the platform is supported, if not, an error message is specified (at the moment restricts 95/98/ME, Systems that lack HTTPD.SYS and versions of the .NET framework prior to 2.0) * GetFileName() - returns a system valid filename, on windows this places data in the Application Data directory, on UNIX, the folder in which the application is calling from.
Diffstat (limited to 'OpenSim/Framework/General/Util.cs')
-rw-r--r--OpenSim/Framework/General/Util.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs
index 97fe7da..bbee4b2 100644
--- a/OpenSim/Framework/General/Util.cs
+++ b/OpenSim/Framework/General/Util.cs
@@ -63,6 +63,61 @@ namespace OpenSim.Framework.Utilities
63 return id; 63 return id;
64 } 64 }
65 65
66 public static string GetFileName(string file)
67 {
68 // Return just the filename on UNIX platforms
69 // TODO: this should be customisable with a prefix, but that's something to do later.
70 if (System.Environment.OSVersion.Platform == PlatformID.Unix)
71 {
72 return file;
73 }
74
75 // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA
76 // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData
77 if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
78 {
79 if (!System.IO.Directory.Exists("%APPDATA%\\OpenSim\\"))
80 {
81 System.IO.Directory.CreateDirectory("%APPDATA%\\OpenSim");
82 }
83
84 return "%APPDATA%\\OpenSim\\" + file;
85 }
86
87 // Catch all - covers older windows versions
88 // (but those probably wont work anyway)
89 return file;
90 }
91
92 public static bool IsEnvironmentSupported(ref string reason)
93 {
94 // Must have .NET 2.0 (Generics / libsl)
95 if (System.Environment.Version.Major < 2)
96 {
97 reason = ".NET 1.0/1.1 lacks components that is used by OpenSim";
98 return false;
99 }
100
101 // Windows 95/98/ME are unsupported
102 if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows &&
103 System.Environment.OSVersion.Platform != PlatformID.Win32NT)
104 {
105 reason = "Windows 95/98/ME will not run OpenSim";
106 return false;
107 }
108
109 // Windows 2000 / Pre-SP2 XP
110 if (System.Environment.OSVersion.Version.Major == 5 && (
111 System.Environment.OSVersion.Version.Minor == 0 ||
112 System.Environment.OSVersion.ServicePack == "Service Pack 1"))
113 {
114 reason = "Please update to Windows XP Service Pack 2 or Server2003";
115 return false;
116 }
117
118 return true;
119 }
120
66 public static int UnixTimeSinceEpoch() 121 public static int UnixTimeSinceEpoch()
67 { 122 {
68 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 123 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));