internal override bool FileExists(string fullPath)
            {
                if (fullPath != null)
                {
                    _loggerOpt?.AddRead(fullPath);
                }

                return(base.FileExists(fullPath));
            }
Пример #2
0
        /// <summary>
        /// Resolves file name against the <see cref="FileResolver"/>'s base
        /// directory. Also logs the file as touched.
        /// </summary>
        internal string ResolveRelativePath(string path)
        {
            string resolved = FileUtilities.ResolveRelativePath(path, baseDirectory);

            if (touchedFiles != null && resolved != null)
            {
                touchedFiles.AddRead(resolved);
            }
            return(resolved);
        }
Пример #3
0
            protected override bool FileExists(string fullPath)
            {
                if (logger != null && fullPath != null)
                {
                    logger.AddRead(fullPath);
                }

                return(base.FileExists(fullPath));
            }
            protected override bool FileExists(string?fullPath)
            {
                if (fullPath != null)
                {
                    _logger?.AddRead(fullPath);
                }

                return(base.FileExists(fullPath));
            }
Пример #5
0
            public override string ResolveReference(string reference, string baseFilePath)
            {
                var path = _resolver.ResolveReference(reference, baseFilePath);

                if (path != null)
                {
                    _logger.AddRead(path);
                }
                return(path);
            }
Пример #6
0
            public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
            {
                string fullPath = _pathResolver.ResolvePath(reference, baseFilePath);

                if (fullPath != null)
                {
                    _loggerOpt?.AddRead(fullPath);
                    return(ImmutableArray.Create(_provider(fullPath, properties)));
                }

                return(ImmutableArray <PortableExecutableReference> .Empty);
            }
        /// <summary>
        /// Resolves assembly strong name key file path.
        /// Internal for testing.
        /// </summary>
        /// <returns>Normalized key file path or null if not found.</returns>
        internal string ResolveStrongNameKeyFile(string path)
        {
            // Dev11: key path is simply appended to the search paths, even if it starts with the current (parent) directory ("." or "..").
            // This is different from PathUtilities.ResolveRelativePath.

            if (PathUtilities.IsAbsolute(path))
            {
                if (FileExists(path))
                {
                    if (touchedFiles != null)
                    {
                        touchedFiles.AddRead(path);
                    }

                    return(FileUtilities.NormalizeAbsolutePath(path));
                }

                return(path);
            }

            foreach (var searchPath in this.keyFileSearchPaths)
            {
                string combinedPath = PathUtilities.CombineAbsoluteAndRelativePaths(searchPath, path);

                Debug.Assert(combinedPath == null || PathUtilities.IsAbsolute(combinedPath));

                if (FileExists(combinedPath))
                {
                    if (touchedFiles != null)
                    {
                        touchedFiles.AddRead(combinedPath);
                    }

                    return(FileUtilities.NormalizeAbsolutePath(combinedPath));
                }
            }

            return(null);
        }