3
$\begingroup$

Let's create a test package/paclet in a standard $UserBaseDirectory/Applications:

root = FileNameJoin[{$UserBaseDirectory, "Applications", "TestPaclet", ##}]&;

CreateFile @ root["Kernel", "init.m"]
Export[ root["Kernel", "init.m"], "Echo[$InputFileName]", "Text"];

Export[
    root["PacletInfo.m"]
  , Paclet[Name -> "TestPaclet",Version -> "0.0.1", MathematicaVersion -> "11+",
    Description -> "", Creator -> "Kuba", 
    Extensions -> { {"Kernel", Context -> "TestPaclet`"}}]  
];

And let's try it:

Get["TestPaclet`"];

Get["TestPaclet`", Path -> {$HomeDirectory}]

>> ...\Applications\TestPaclet\Kernel\init.m

Get::noopen: Cannot open TestPaclet`.

$Failed

Before Paclets appeared, Path option for Get shielded against the default $Path. Which I find expected and desired but I can agree it is subjective. Anyway, it is not the case for default paclets repositories:

PacletInstall @ PackPaclet @ root[]

Get["TestPaclet`"];

Get["TestPaclet`", Path -> {$HomeDirectory}];
Paclet[TestPaclet,0.0.1,<>]

>> ...\Paclets\Repository\TestPaclet-0.0.1\Kernel\init.m

>> ...\Paclets\Repository\TestPaclet-0.0.1\Kernel\init.m

Considering previous behavior I find the new one a bug.

[CASE:4016445] was created

$\endgroup$
  • 2
    $\begingroup$ Possible duplicate of $Path hijacked by PacletManager? $\endgroup$ – ilian Feb 13 '18 at 21:39
  • $\begingroup$ @ilian very closely related but it does not cover Paclets/Repository scenario and Path option. And the real question I have is how to block my Get from paclets directory? If there is no way then there is a serious problem. $\endgroup$ – Kuba Feb 13 '18 at 21:46
  • $\begingroup$ @ilian ref/Get: "Get[name,Path->{"dir1","dir2", ...}] successively searches for files in each of the diri." so my example exposes at least a documentation bug because the last code line of mine clearly does more. $\endgroup$ – Kuba Feb 13 '18 at 21:51
  • $\begingroup$ But the previous question also covers overriding $Path and your Paclets/Repository is just where the paclet is, nothing more. $\endgroup$ – ilian Feb 13 '18 at 21:56
  • $\begingroup$ @ilian I'm abusing the fact the Path (the option) does not say anything about $Path. And again, I don't insist on Get["TestPaclet`", Path -> {FileNameJoin[{$UserBaseDirectory, "Applications"}]}] reaching Applications (though that is expected). Where is that (this or linked) behavior documented? If we mark it a duplicate the OP deserves bugs tag. $\endgroup$ – Kuba Feb 13 '18 at 22:10
3
$\begingroup$

I'm not going to write an answer, but in terms of getting your desired behavior, try

Block[{Internal`PacletFindFile}, 
 Get["TestPaclet`", Path -> {$HomeDirectory}]]

Get::noopen: Cannot open TestPaclet`.

(* $Failed *)
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thanks. And re this and FindFile case. It is nowhere documented. Is there any reason not to give it bugs +/- documentation? $\endgroup$ – Kuba Feb 14 '18 at 7:17
  • $\begingroup$ It’s certainly undocumented, like a great many things about the paclet manager (there is a good Q & A about some of them too). $\endgroup$ – ilian Feb 14 '18 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.