Ejemplo n.º 1
0
        public virtual void RemoveEmbeddedByName(string packageName)
        {
            if (isAddRemoveOrEmbedInProgress)
            {
                return;
            }

            var packageInfo = m_UpmCache.GetInstalledPackageInfo(packageName);

            if (packageInfo != null)
            {
                try
                {
                    // Fix case 1237777, make files writable first
                    foreach (var file in m_IOProxy.DirectoryGetFiles(packageInfo.resolvedPath, "*", System.IO.SearchOption.AllDirectories))
                    {
                        m_IOProxy.MakeFileWritable(file, true);
                    }
                    m_IOProxy.DeleteDirectory(packageInfo.resolvedPath);
                    Resolve();
                }
                catch (System.IO.IOException e)
                {
                    Debug.Log($"[Package Manager] Cannot remove embedded package {packageName}: {e.Message}");
                }
            }
        }
Ejemplo n.º 2
0
 public static string GetOfflineDocumentation(IOProxy IOProxy, IPackageVersion version)
 {
     if (version?.isAvailableOnDisk == true && version.packageInfo != null)
     {
         try
         {
             var docsFolder = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "Documentation~");
             if (!IOProxy.DirectoryExists(docsFolder))
             {
                 docsFolder = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "Documentation");
             }
             if (IOProxy.DirectoryExists(docsFolder))
             {
                 var mdFiles = IOProxy.DirectoryGetFiles(docsFolder, "*.md", System.IO.SearchOption.TopDirectoryOnly);
                 var docsMd  = mdFiles.FirstOrDefault(d => IOProxy.GetFileName(d).ToLower() == "index.md")
                               ?? mdFiles.FirstOrDefault(d => IOProxy.GetFileName(d).ToLower() == "tableofcontents.md") ?? mdFiles.FirstOrDefault();
                 if (!string.IsNullOrEmpty(docsMd))
                 {
                     return(docsMd);
                 }
             }
         }
         catch (System.IO.IOException) {}
     }
     return(string.Empty);
 }