Browse Source

Support addins with subdirectories from the online gallery.

Addin manager now copies all files and subdirectories from the extracted
NuGet package to the temporary addin installation folder.
addin-manager-package-subdirectories
Matt Ward 12 years ago
parent
commit
e4b067feed
  1. 36
      src/AddIns/Misc/AddInManager2/Project/Src/Model/AddInSetup.cs

36
src/AddIns/Misc/AddInManager2/Project/Src/Model/AddInSetup.cs

@ -445,20 +445,7 @@ namespace ICSharpCode.AddInManager2.Model @@ -445,20 +445,7 @@ namespace ICSharpCode.AddInManager2.Model
{
Directory.Delete(targetDir, true);
}
Directory.CreateDirectory(targetDir);
var packageContentsFiles = Directory.EnumerateFiles(packageDirectory, "*.*", SearchOption.TopDirectoryOnly);
if (packageContentsFiles != null)
{
foreach (var file in packageContentsFiles)
{
// Don't copy the .nupkg file
FileInfo fileInfo = new FileInfo(file);
if (fileInfo.Extension != ".nupkg")
{
File.Copy(file, Path.Combine(targetDir, fileInfo.Name));
}
}
}
DeepCopy(packageDirectory, targetDir);
return true;
}
@ -467,6 +454,27 @@ namespace ICSharpCode.AddInManager2.Model @@ -467,6 +454,27 @@ namespace ICSharpCode.AddInManager2.Model
return false;
}
}
void DeepCopy(string packageDirectory, string targetDirectory)
{
Directory.CreateDirectory(targetDirectory);
foreach (string file in Directory.EnumerateFiles(packageDirectory, "*.*", SearchOption.TopDirectoryOnly))
{
// Don't copy the .nupkg file
FileInfo fileInfo = new FileInfo(file);
if (fileInfo.Extension != ".nupkg")
{
File.Copy(file, Path.Combine(targetDirectory, fileInfo.Name));
}
}
foreach (string packageSubDirectory in Directory.EnumerateDirectories(packageDirectory))
{
string newTargetDirectory = Path.Combine(targetDirectory, Path.GetFileName(packageSubDirectory));
DeepCopy(packageSubDirectory, newTargetDirectory);
}
}
public void CancelUpdate(AddIn addIn)
{

Loading…
Cancel
Save