コード例 #1
0
 public static bool SetWorking(string directory)
 {
     if (directory != null)
     {
         string newPath = PhpPath.AbsolutePath(directory);
         if (System.IO.Directory.Exists(newPath))
         {
             // Note: open_basedir not applied here, URL will not pass through
             ScriptContext.CurrentContext.WorkingDirectory = newPath;
             return(true);
         }
     }
     PhpException.Throw(PhpError.Warning, LibResources.GetString("directory_not_found", directory));
     return(false);
 }
コード例 #2
0
        public static string RealPath(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                return(null);
            }

            // string ending slash
            if (IsDirectorySeparator(path[path.Length - 1]))
            {
                path = path.Substring(0, path.Length - 1);
            }

            string realpath = PhpPath.AbsolutePath(path);

            if (!File.Exists(realpath) && !System.IO.Directory.Exists(realpath))
            {
                return(null);
            }

            return(realpath);
        }