aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorMichael Cortez2009-08-06 09:38:51 -0700
committerMichael Cortez2009-08-06 09:38:51 -0700
commit2ac04cb624d36c048b6793f9db7c073eb6a01026 (patch)
treecb76f55c634c9f1107dea7204729497c5ba3bb75 /OpenSim/Framework/Util.cs
parentFixing comments re: INI file. (diff)
parentAdd the config-include statement to OpenSim.ini.example. (diff)
downloadopensim-SC-2ac04cb624d36c048b6793f9db7c073eb6a01026.zip
opensim-SC-2ac04cb624d36c048b6793f9db7c073eb6a01026.tar.gz
opensim-SC-2ac04cb624d36c048b6793f9db7c073eb6a01026.tar.bz2
opensim-SC-2ac04cb624d36c048b6793f9db7c073eb6a01026.tar.xz
Merge branch 'master' into groups-core-contrib
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 0a9b67d..65d4f4d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1111,5 +1111,56 @@ namespace OpenSim.Framework
1111 return null; 1111 return null;
1112 } 1112 }
1113 1113
1114 public static string[] Glob(string path)
1115 {
1116 string vol=String.Empty;
1117
1118 if (Path.VolumeSeparatorChar != Path.DirectorySeparatorChar)
1119 {
1120 string[] vcomps = path.Split(new char[] {Path.VolumeSeparatorChar}, 2, StringSplitOptions.RemoveEmptyEntries);
1121
1122 if (vcomps.Length > 1)
1123 {
1124 path = vcomps[1];
1125 vol = vcomps[0];
1126 }
1127 }
1128
1129 string[] comps = path.Split(new char[] {Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar}, StringSplitOptions.RemoveEmptyEntries);
1130
1131 // Glob
1132
1133 path = vol;
1134 if (vol != String.Empty)
1135 path += new String(new char[] {Path.VolumeSeparatorChar, Path.DirectorySeparatorChar});
1136 else
1137 path = new String(new char[] {Path.DirectorySeparatorChar});
1138
1139 List<string> paths = new List<string>();
1140 List<string> found = new List<string>();
1141 paths.Add(path);
1142
1143 foreach (string c in comps)
1144 {
1145 List<string> addpaths = new List<string>();
1146 foreach (string p in paths)
1147 {
1148 string[] dirs = Directory.GetDirectories(p, c);
1149
1150 if (dirs.Length != 0)
1151 {
1152 foreach (string dir in dirs)
1153 addpaths.Add(Path.Combine(path, dir));
1154 }
1155
1156 string[] files = Directory.GetFiles(p, c);
1157 foreach (string f in files)
1158 found.Add(f);
1159 }
1160 paths = addpaths;
1161 }
1162
1163 return found.ToArray();
1164 }
1114 } 1165 }
1115} 1166}