From fda08a376e2ae529ef2f4412fc17d4e909788618 Mon Sep 17 00:00:00 2001 From: Craig Long Date: Wed, 20 May 2020 09:33:27 -0400 Subject: [PATCH 1/3] Fix filename string if path includes an apostrophe --- src/Engine/ProtoCore/Utils/FileUtils.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Engine/ProtoCore/Utils/FileUtils.cs b/src/Engine/ProtoCore/Utils/FileUtils.cs index 8704ec92b4e..2ae939c1039 100644 --- a/src/Engine/ProtoCore/Utils/FileUtils.cs +++ b/src/Engine/ProtoCore/Utils/FileUtils.cs @@ -23,6 +23,9 @@ public static string GetDSFullPathName(string fileName, Options options = null) var trimChars = new[] {'\n','\t','\r',' '}; fileName = fileName.Trim(trimChars); + // Fix file paths which include an apostrophe + fileName = fileName.Replace("\\'", "'"); + //1. First search at .exe module directory, in case files of the same name exists in the following directories. // The .exe module directory is of highest priority. // CodeBase is used here because Assembly.Location does not work quite well when the module is shallow-copied in nunit test. From a6393ea660f28d6863e9a88e5bb46eb712d9c0e0 Mon Sep 17 00:00:00 2001 From: Craig Long Date: Wed, 20 May 2020 10:06:34 -0400 Subject: [PATCH 2/3] Add test for apostrophe load --- test/DynamoCoreTests/DSLibraryTest.cs | 13 +++++++++++++ test/pkgs/Pack'age/bin/Package.dll | Bin 0 -> 4096 bytes test/pkgs/Pack'age/pkg.json | 1 + 3 files changed, 14 insertions(+) create mode 100644 test/pkgs/Pack'age/bin/Package.dll create mode 100644 test/pkgs/Pack'age/pkg.json diff --git a/test/DynamoCoreTests/DSLibraryTest.cs b/test/DynamoCoreTests/DSLibraryTest.cs index 5b37cfc4372..ba84037017f 100644 --- a/test/DynamoCoreTests/DSLibraryTest.cs +++ b/test/DynamoCoreTests/DSLibraryTest.cs @@ -121,6 +121,19 @@ public void TestLoadDllFileSuccess() Assert.IsTrue(LibraryLoaded); } + [Test] + [Category("UnitTests")] + public void TestLoadDllFileWithApostropheInPathSuccess() + { + LibraryLoaded = false; + + string libraryPath = Path.Combine(TestDirectory, "pkgs", "Pack'age", "bin", @"Package.dll"); + + libraryServices.ImportLibrary(libraryPath); + + Assert.IsTrue(LibraryLoaded); + } + [Test] [Category("UnitTests")] public void TestLibraryAcrossSessions() diff --git a/test/pkgs/Pack'age/bin/Package.dll b/test/pkgs/Pack'age/bin/Package.dll new file mode 100644 index 0000000000000000000000000000000000000000..58050bf72fc19d52531dcabdebf0b36eef896704 GIT binary patch literal 4096 zcmeHKU2GIp6h5>4p_Ec61>`54Q~cj;=Wif-F&X|=SaTPn&XbawZ$9hjXNXJ(;m zjH!wm-i-0V7!w~%On8teF%gYF2?;UL;G4$yV2Dq?C_dD#aUfFz68NRZ4V%qRj$F=jW zUQn~TW!b)(5vp6XRKrq}qbapu=Y+O=dE?fy>#=^KVWo!l{V;>s1Gq|C)MZMPr~!0+ zz>Dlauc9T;h*rvRB#4_CWi_H%5a2V^(A2Z6%71fxnPe8={C1*I9wdmSxeyCsil_;^ zpSBV0TPV93tp?$TDh;3qLjt|#iy0q%!xA8s2WaKEF_NGXO=+&@WD>&}my{QL#m9lq^^;BGoYMs%}ST|2rM<(zGFl&2~XeV-rqqU`c*Rb*) zYow7sFK64~6q(`pz~P}Jcu#1X;~si%y>co%)9tf1RrT2F`QO>n-F_&te-6y~gvSd(~K^7qp>;BS=p zRmpjVX2EHXydftEX5zXi$gUN?9yuOUIg;n-V`T^Ed_b+c3`+$WT}Fg0!1c5qxDl~k zR#s9>;%WrzGd7#94YCoRjo6uty)!2CAJ6s!J7U#RyAQflbvL`@VyAu4sz;so-U8 z*EBLTre{y;c|iw?My|)lmdF%+K}nG*=JR^S6mz^jyD({Z#ynn+=ZQkbEKL}GwQ7a! z>N!!+-IH@(CUiG1`~h5L;^L2 zN}ewYT3Jaer-@S-E`ydcO$xNioi;9xnBLIyP-5`=y}Wbd?V|HtkCiPGHg?&Imn_3^7`q0o$LgfC>GO?)ILB5NOZ zb!Wu3`e(92F51MjYoGQM=q-_lw+VxAgHoMj-KNm0%7Unu&Z+9&C|`5C6x!O|wKsm( z@w?+4v3(-m5%27bb#!-kWji`EA|CG&@oqiFmpPoqa6jTlG^Ef5ZKQvqvLV~ci?Sbg zXcvNPUR@C-4bL(4(g?QhDz;H85*50f*KaQ$dXam+1D{4~$2-s-q|9sy^4Sat^y8^y z>dw!{E`0a($l#fm+J*;?p1;PK_T7^{?BN`w9qe}9(Y2mrDxI{m#e%SWFO8#E)J-+z z7juTqHRwuX1M`x3>7;Okm4jNjcImLUGbbR#(GEG9lgrST<=2XX`jN*fj}}Atss)l` zeYTr4&4apO1-FS1a`y((>)YUEVXBK={wFy6`Vg%PzM`r!=0iY)O*mV{#E`kcx5JSH zwrhe`FtBXFYz4k}-s~h@!pzMm@2i~LAkOZN? zt4=Qb7&z|&J}o+4KKEPYt1fAzNMQl~wQ^*#NCD@+3TXl$CKf^Wq$XT^4Vs zj_3r8qx0-0!E<3bmsbpLZM4$(d$kGkaAka{Yr&IQ70rDA8s#A6@2^2x1-oI`QG5Wn5SuY!iQ|TNIl1h6KLyY)yZa2JC`w3Pg2fqdQb&*+EHKK%!b+kMOuL#E) z)`%&tG|^wh9MonE_BQe;qHcawrVH)xT`6lhUw>gm7uS>5tp`ziGKUNzEFt5+vqRXo WE~vr(47KuAxOKz)KeB(P0)GObpg=GH literal 0 HcmV?d00001 diff --git a/test/pkgs/Pack'age/pkg.json b/test/pkgs/Pack'age/pkg.json new file mode 100644 index 00000000000..6a3c2dae084 --- /dev/null +++ b/test/pkgs/Pack'age/pkg.json @@ -0,0 +1 @@ +{"license":"","file_hash":null,"name":"Package","version":"1.0.0","description":"original package","group":"","keywords":null,"dependencies":[],"contents":"","engine_version":"2.1.0.7840","engine":"dynamo","engine_metadata":"","site_url":"","repository_url":"","contains_binaries":true,"node_libraries":["Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"]} \ No newline at end of file From 2270e15c2b22cc199f0936cfb6bceb66bdc1616e Mon Sep 17 00:00:00 2001 From: Craig Long Date: Wed, 20 May 2020 10:07:40 -0400 Subject: [PATCH 3/3] Add test for load at path and rename exsiting mislabled test --- test/DynamoCoreTests/DSLibraryTest.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/DynamoCoreTests/DSLibraryTest.cs b/test/DynamoCoreTests/DSLibraryTest.cs index ba84037017f..9f42dd13379 100644 --- a/test/DynamoCoreTests/DSLibraryTest.cs +++ b/test/DynamoCoreTests/DSLibraryTest.cs @@ -105,7 +105,7 @@ public void TestLoadDllFileFailure() [Test] [Category("UnitTests")] - public void TestLoadDllFileSuccess() + public void TestLoadDllFileSuccessWithLibrarySearchPathsResultionToFindDLL() { LibraryLoaded = false; @@ -121,6 +121,19 @@ public void TestLoadDllFileSuccess() Assert.IsTrue(LibraryLoaded); } + [Test] + [Category("UnitTests")] + public void TestLoadDllFileAtPathSuccess() + { + LibraryLoaded = false; + + string libraryPath = Path.Combine(TestDirectory, "pkgs", "Package", "bin", @"Package.dll"); + + libraryServices.ImportLibrary(libraryPath); + + Assert.IsTrue(LibraryLoaded); + } + [Test] [Category("UnitTests")] public void TestLoadDllFileWithApostropheInPathSuccess()