コード例 #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);
        }
コード例 #3
0
ファイル: FileSystem.CLR.cs プロジェクト: jiahao42/weverca
 /// <summary>
 /// Check the cache for given <paramref name="path"/>.
 /// </summary>
 /// <param name="path">Path to lookup in the cache.</param>
 /// <param name="url">Url of <paramref name="path"/>.</param>
 /// <returns>True if given <paramref name="path"/> is in the cache currently.</returns>
 private static bool StatInternalTryCache(string path, out string url)
 {
     // Try to hit the cache first
     url = PhpPath.GetUrl(path);
     return(url == statCacheUrl);
 }