modify nuget package installer to support satellite assemblies in subfolders
This commit is contained in:
parent
d2ffb93fa4
commit
2780e4d029
@ -93,10 +93,14 @@
|
||||
<Pane Name="Bottom Full Width" />
|
||||
@if (_footer)
|
||||
{
|
||||
<div class="bg-primary footer">
|
||||
<div class="bg-primary fixed-bottom footer">
|
||||
<Pane Name="Footer" />
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Pane Name="Footer" />
|
||||
}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="title" ResourceKey="Title" HelpText="Specify If The Page Footer Should Be Displayed">Display Footer?</Label>
|
||||
<Label For="footer" ResourceKey="Footer" HelpText="Specify If A Footer Should Always Be Displayed In A Fixed Location At The Bottom Of The Browser Window">Display Fixed Footer?</Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="title" class="form-control" @bind="@_footer">
|
||||
<select id="footer" class="form-control" @bind="@_footer">
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
|
@ -38,7 +38,7 @@ namespace Oqtane.Infrastructure
|
||||
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
|
||||
{
|
||||
bool install = false;
|
||||
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||
string binPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||
|
||||
foreach (string folder in folders.Split(','))
|
||||
{
|
||||
@ -82,40 +82,37 @@ namespace Oqtane.Infrastructure
|
||||
List<string> assets = new List<string>();
|
||||
bool manifest = false;
|
||||
|
||||
// module and theme packages must be in form of name.1.0.0.nupkg
|
||||
// packages are in form of name.1.0.0.nupkg or name.culture.1.0.0.nupkg
|
||||
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||
string[] segments = name?.Split('.');
|
||||
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3);
|
||||
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3); // remove version information
|
||||
|
||||
// deploy to appropriate locations
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
string foldername = Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0];
|
||||
string filename = Path.GetFileName(entry.FullName);
|
||||
string filename = "";
|
||||
|
||||
if (!manifest && filename == "assets.json")
|
||||
// evaluate entry root folder
|
||||
switch (entry.FullName.Split('/')[0])
|
||||
{
|
||||
manifest = true;
|
||||
case "lib": // lib/net5.0/...
|
||||
filename = ExtractFile(entry, binPath, 2);
|
||||
break;
|
||||
case "wwwroot": // wwwroot/...
|
||||
filename = ExtractFile(entry, webRootPath, 1);
|
||||
break;
|
||||
case "runtimes": // runtimes/name/...
|
||||
filename = ExtractFile(entry, binPath, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (foldername)
|
||||
if (filename != "")
|
||||
{
|
||||
case "lib":
|
||||
filename = Path.Combine(binFolder, filename);
|
||||
ExtractFile(entry, filename);
|
||||
assets.Add(filename.Replace(contentRootPath, ""));
|
||||
break;
|
||||
case "wwwroot":
|
||||
filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace("wwwroot/", "").Split('/')));
|
||||
ExtractFile(entry, filename);
|
||||
assets.Add(filename.Replace(contentRootPath, ""));
|
||||
break;
|
||||
case "runtimes":
|
||||
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
||||
filename = Path.Combine(binFolder, destSubFolder, filename);
|
||||
ExtractFile(entry, filename);
|
||||
assets.Add(filename.Replace(contentRootPath, ""));
|
||||
break;
|
||||
assets.Add(filename.Replace(contentRootPath, ""));
|
||||
if (!manifest && Path.GetFileName(filename) == "assets.json")
|
||||
{
|
||||
manifest = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,21 +142,25 @@ namespace Oqtane.Infrastructure
|
||||
return install;
|
||||
}
|
||||
|
||||
private static void ExtractFile(ZipArchiveEntry entry, string filename)
|
||||
private static string ExtractFile(ZipArchiveEntry entry, string folder, int ignoreLeadingSegments)
|
||||
{
|
||||
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||
}
|
||||
string[] segments = entry.FullName.Split('/'); // ZipArchiveEntries always use unix path separator
|
||||
string filename = Path.Combine(folder, string.Join(Path.DirectorySeparatorChar, segments, ignoreLeadingSegments, segments.Length - ignoreLeadingSegments));
|
||||
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||
}
|
||||
entry.ExtractToFile(filename, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// an error occurred extracting the file
|
||||
filename = "";
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void UpgradeFramework()
|
||||
|
@ -55,6 +55,7 @@ div.app-moduleactions a.dropdown-toggle, div.app-moduleactions div.dropdown-menu
|
||||
min-height: 40px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user