public string TransformPath(CppInclusionContext context, string path)
        {
            var solutionFolder = mySolution.SolutionDirectory;

            if (solutionFolder.Combine(path).Exists != FileSystemPath.Existence.Missing)
            {
                return(path);
            }

            var pos = path.IndexOf('/') + 1;

            if (pos == -1)
            {
                return(path);
            }
            var endPos = path.IndexOf('/', pos);

            if (endPos == -1)
            {
                endPos = path.Length;
            }

            var packageName = path.Substring(pos, endPos - pos);

            var packagePath = GetPackagePath(packageName);

            if (packagePath == null)
            {
                return(path);
            }

            return(packagePath + path.Substring(endPos));
        }
Exemple #2
0
        public string TransformPath(CppInclusionContext context, string path)
        {
            var solutionFolder = mySolution.SolutionDirectory;

            if (solutionFolder.Combine(path).Exists != FileSystemPath.Existence.Missing)
            {
                return(path);
            }

            var pos = path.IndexOf('/') + 1;

            if (pos == -1)
            {
                return(path);
            }
            var endPos = path.IndexOf('/', pos);

            if (endPos == -1)
            {
                endPos = path.Length;
            }

            var packageName = path.Substring(pos, endPos - pos);

            var suffix = GetCacheSuffix(packageName);

            if (suffix == null)
            {
                return(path);
            }

            var localPackagePath = FileSystemPath.Parse("Packages")
                                   .Combine(packageName + "@" + suffix + path.Substring(endPos));

            if (solutionFolder.Combine(localPackagePath).Exists == FileSystemPath.Existence.File)
            {
                return(localPackagePath.FullPath);
            }

            var cachedPackagePath = FileSystemPath.Parse("Library").Combine("PackageCache")
                                    .Combine(packageName + "@" + suffix + path.Substring(endPos));

            return(cachedPackagePath.FullPath);
        }
Exemple #3
0
 public bool IsApplicable(CppInclusionContext context, string path)
 {
     return(path.StartsWith("Packages/") &&
            (mySolutionTracker.IsUnityProject.HasTrueValue() ||
             myReferencesTracker.HasUnityReference.HasTrueValue()));
 }