diff options
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 55 |
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)); |