From c667f9372e93daaf156e4eea54415ccb39747128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 22 Nov 2017 14:45:09 +0300 Subject: [PATCH] Simplify EmbeddedFileSet. --- .../Blogging/AbpDeskMongoBlogModule.cs | 1 - src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll | Bin 15360 -> 15360 bytes .../AbpAccountWebModule.cs | 1 - .../AbpAspNetCoreMvcUiBootstrapModule.cs | 1 - .../AbpAspNetCoreMvcUiModule.cs | 1 - .../AbpIdentityWebModule.cs | 1 - .../Embedded/EmbeddedFileSet.cs | 23 +++++++++++------- .../EmbeddedFileManager_Tests.cs | 3 +-- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/AbpDesk/AbpDesk.MongoBlog/AbpDesk/Blogging/AbpDeskMongoBlogModule.cs b/src/AbpDesk/AbpDesk.MongoBlog/AbpDesk/Blogging/AbpDeskMongoBlogModule.cs index 21dc026329..a6ef043fa5 100644 --- a/src/AbpDesk/AbpDesk.MongoBlog/AbpDesk/Blogging/AbpDeskMongoBlogModule.cs +++ b/src/AbpDesk/AbpDesk.MongoBlog/AbpDesk/Blogging/AbpDeskMongoBlogModule.cs @@ -28,7 +28,6 @@ namespace AbpDesk.Blogging { options.FileSets.Add( new EmbeddedFileSet( - "/", GetType().Assembly, "" //TODO: This is not tested yet! ) diff --git a/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll b/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll index 6426ca7db286326e2006a991a7a39f917f60a8b5..c867134e443e43907db34ca4e2921e9f98c9d2c4 100644 GIT binary patch delta 862 zcmYL{TSyd97{~u-j(Zv1ogKB+UA5e8*KH}Sb=@Sa?55cT(Ml;_)M^8ZK$#+ph+RXY zAfjb@5F*IHz-|;<^b%5Fz9l}{LsGdt6!cJmP)ShVoEh-InK{4z|9t2B&LusV9=vfS z@7QE=CUdQVt8y5(cDboQC~%2LG1y#k?kINzxl^Nw>l=5T#V> zA~vl|e_)FwLshe{yc9Hz?T#FC zApkS}OTPCHa6C=RDg^P^Ma9+X?=SLX$yuod`D z$}ttymiJjw=@>T(G7BxlHbF+ABfJo&%{Wn-7oI93gL#Ht_yjGmUv4{yB8ZZ?z~*^? zu#BD?U>if^F7@0TZO#6TjJmvmzz3@JLqAsLX<}M!DHM4K`v!Uy;r(<1j^!d7;B5pl)Bj-wE9LNMqm?xV| Y+-LfeL~mB9U*b|Mo-J(n&N4B_e?wQP@c;k- delta 954 zcmYk5TSyd97{~u-W^bcA>!^53DYw0}mEvVhL`z)DTa<1WGkvJUdN9b9*+@ZSSJ03U zbD4-Dg_5p95iHSbkcm_eJ{5uxZUlmXJ``b3eRFog&S5UU|Nr~W_syA^=wNhkYTU#& z`#!`b3fN@qd55FsB+v#L7l1)A=FGH50Xy;337|>~R1|5QY!ADwjj)I_M8W!KrbB=k z{a(s*1B|P{Qrszw3i@)Hr6#l*D#TD3kfQz+&@cGP={Dro*(9PrT%qFuI{k}MNc}&` zEoyH~M+C2^SJKjEk(81FUx1b?wyJ_D{@rq)<=IVutNj#)cLEAM zrmLyFWV1b)cEcde%B(FIc zDV2!{WoaUt`6e*+9@UBs$1GR=1wJLC+$sI{1 zezmD$8rlqV%{D}I)=2y!B$&d#9bjJiCMdLxz1&MSnvO6hz0ol-9S@RuytOPG_UILo zdzgh|oL1Ry*#aUjd}OY&6|s=8l|E4*xxv}!;*?CxMo)ZQew|aCR)PRjTtYX(C;?Kp z37I7r;8R72=2d79J?qM^t=XcL&Rva@eP_m&-yNNaPkZm$vu;&QZ-E^T3REym$0Gef zi&~4{rF41O+Lb^@{nJNv?+ files) @@ -28,12 +30,12 @@ namespace Volo.Abp.VirtualFileSystem.Embedded foreach (var resourcePath in Assembly.GetManifestResourceNames()) { - if (!resourcePath.StartsWith(ResourceNamespace)) + if (!BaseNamespace.IsNullOrEmpty() && !resourcePath.StartsWith(BaseNamespace)) { continue; } - var fullPath = RootPath + ConvertToRelativePath(resourcePath); + var fullPath = ConvertToRelativePath(resourcePath).EnsureStartsWith('/'); if (fullPath.Contains("/")) { @@ -92,7 +94,10 @@ namespace Volo.Abp.VirtualFileSystem.Embedded private string ConvertToRelativePath(string resourceName) { - resourceName = resourceName.Substring(ResourceNamespace.Length + 1); + if (!BaseNamespace.IsNullOrEmpty()) + { + resourceName = resourceName.Substring(BaseNamespace.Length + 1); + } var pathParts = resourceName.Split('.'); if (pathParts.Length <= 2) diff --git a/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/EmbeddedFileManager_Tests.cs b/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/EmbeddedFileManager_Tests.cs index b59fb510a0..abda04da2e 100644 --- a/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/EmbeddedFileManager_Tests.cs +++ b/test/Volo.Abp.VirtualFileSystem.Tests/Volo/Abp/VirtualFileSystem/EmbeddedFileManager_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.VirtualFileSystem public void Should_Define_And_Get_Embedded_Resources() { //Act - var resource = _embeddedFileManager.GetFileInfo("/MyApp/MyResources/js/jquery-3.1.1.min.js"); + var resource = _embeddedFileManager.GetFileInfo("/js/jquery-3.1.1.min.js"); //Assert resource.ShouldNotBeNull(); @@ -44,7 +44,6 @@ namespace Volo.Abp.VirtualFileSystem { options.FileSets.Add( new EmbeddedFileSet( - "/MyApp/MyResources/", GetType().Assembly, "Volo.Abp.VirtualFileSystem.MyResources" )