PHP.Core.PhpStream.CheckIncludePath C# (CSharp) Method

CheckIncludePath() private static method

Check if the path lays inside of the directory tree specified by the open_basedir configuration option and return the resulting absolutePath.
private static CheckIncludePath ( string relativePath, string &absolutePath ) : bool
relativePath string The filename to search for.
absolutePath string The combined absolute path (either in the working directory /// or in an include path wherever it has been found first).
return bool
		private static bool CheckIncludePath(string relativePath, ref string absolutePath)
		{
			// Note: If the absolutePath exists, it overtakse the include_path search.
			if (Path.IsPathRooted(relativePath)) return false;
			if (File.Exists(absolutePath)) return false;

			string paths = ScriptContext.CurrentContext.Config.FileSystem.IncludePaths;
			if (paths == null) return false;

			foreach (string s in paths.Split(new char[] { Path.PathSeparator }))
			{
				if ((s == null) || (s == string.Empty)) continue;
				string abs = Path.GetFullPath(Path.Combine(s, relativePath));
				if (File.Exists(abs))
				{
					absolutePath = abs;
					return true;
				}
			}
			return false;
		}