resolve package name from folder name
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Cms.Core.PropertyEditors;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Core.Manifest
|
||||
{
|
||||
@@ -10,10 +12,30 @@ namespace Umbraco.Cms.Core.Manifest
|
||||
[DataContract]
|
||||
public class PackageManifest
|
||||
{
|
||||
[DataMember(Name = "name", IsRequired = false)]
|
||||
public string PackageName { get; set; }
|
||||
private string _packageName;
|
||||
|
||||
[DataMember(Name = "packageView", IsRequired = false)]
|
||||
/// <summary>
|
||||
/// An optional package name. If not specified then the directory name is used.
|
||||
/// </summary>
|
||||
[DataMember(Name = "name")]
|
||||
public string PackageName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_packageName.IsNullOrWhiteSpace())
|
||||
{
|
||||
return _packageName;
|
||||
}
|
||||
if (!Source.IsNullOrWhiteSpace())
|
||||
{
|
||||
_packageName = Path.GetFileName(Path.GetDirectoryName(Source));
|
||||
}
|
||||
return _packageName;
|
||||
}
|
||||
set => _packageName = value;
|
||||
}
|
||||
|
||||
[DataMember(Name = "packageView")]
|
||||
public string PackageView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -170,7 +170,10 @@ namespace Umbraco.Cms.Core.Manifest
|
||||
private IEnumerable<string> GetManifestFiles()
|
||||
{
|
||||
if (Directory.Exists(_path) == false)
|
||||
return new string[0];
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user