/// <summary> /// Determines the full path for the given file-spec. /// </summary> /// <owner>SumedhK</owner> /// <param name="fileSpec">The file spec to get the full path of.</param> /// <param name="currentDirectory"></param> /// <returns>full path</returns> private static string GetFullPath(string fileSpec, string currentDirectory) { // Sending data out of the engine into the filesystem, so time to unescape. fileSpec = EscapingUtilities.UnescapeAll(fileSpec); // Data coming back from the filesystem into the engine, so time to escape it back. string fullPath = EscapingUtilities.Escape(Path.GetFullPath(Path.Combine(currentDirectory, fileSpec))); if (!EndsWithSlash(fullPath)) { Match drive = FileUtilitiesRegex.DrivePattern.Match(fileSpec); Match UNCShare = FileUtilitiesRegex.UNCPattern.Match(fullPath); if ((drive.Success && (drive.Length == fileSpec.Length)) || (UNCShare.Success && (UNCShare.Length == fullPath.Length))) { // append trailing slash if Path.GetFullPath failed to (this happens with drive-specs and UNC shares) fullPath += Path.DirectorySeparatorChar; } } return(fullPath); }