Re: Re: Re: Re: finding package inExtraPackages`Enhancements`

*To*: mathgroup at smc.vnet.net*Subject*: [mg54196] Re: [mg54183] Re: [mg54127] Re: [mg54096] Re: [mg54065] finding package inExtraPackages`Enhancements`*From*: DrBob <drbob at bigfoot.com>*Date*: Sun, 13 Feb 2005 00:21:27 -0500 (EST)*References*: <200502120658.BAA21847@smc.vnet.net>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

Note that AppendTo[$Path, your_directory_goes_here] is equivalent to $Path = Append[$Path, your_directory_goes_here] Hence, this is redundant, setting $Path twice: $Path = AppendTo[$Path, your_directory_goes_here] Bobby On Sat, 12 Feb 2005 01:58:48 -0500 (EST), David Annetts <davidannetts at aapt.net.au> wrote: > Hi Murray, > >> I'm still at a loss here... What the installation directions >> for Ersek's RootSearch.m actually say is to create, if it's >> not already present, an Enhancements subdirectory of >> ToFileName[{$TopDirectory, "AddOns", "ExtraPackages"}] > > The notebook says that. The Package (.m) says "This package can be > installed by first making an "Enhancements" folder under the > (...\AddOns\ExtraPackages) folder which should be among your hierarchy of > Mathematica folders." The last five words are the key. > > To me, this (ie "your hierarchy of Mathematica folders") means that you can > install the package in (amongst others) :- > > 1. In ToFileName[{$TopDirectory, "AddOns", "ExtraPackages", > "Enhancements"}]. Note that ToFileName[{$TopDirectory, "AddOns", > "ExtraPackages"}] is the directory that contains files for > ProgrammingInMathematica as well as the LinearAlgebraExamples (for 5.???). > > 2. In ToFileName[{$UserBaseDirectory, "Applications", "ExtraPackages"}]. > Why Applications" instead of "AddOns"? ToFileName[{$UserBaseDirectory, > "Applications"}] is in my $Path whereas ToFileName[{$UserBaseDirectory, > "AddOns"}] in not. Moreover, the last directory does not exist on my system > (not that this necessarily counts for anything). > > Why look at the package instead of the notebook, especially when the package > is difficult to read using notepad? The package gives the context, that's > why. The context tells you the directory that the package needs to live in. > Where should this directory be? This directory should be in the $Path. > Contexts are explained in Section 6.16.1 of the online help. > >> and to put RootSearch.m there. >> >> But I want to separate all such add-ons from the Mathematica >> $TopDirectory tree, so they can readily be preserved during >> updates from one version of Mathematica to another. > > That's a good thing to do but this would happen if you put things in > $UserBaseDirectory or $BaseDirectory. Probably, it would also happen if you > put things in ToFileName[{$TopDirectory, "AddOns", "ExtraPackages"}], since > the uninstaller should only clear out files that the installer put in. Note > that in general, $TopDirectory is not the same as $BaseDirectory. > >> So I created a new tree under my $UserBaseDirectory, with top levels: >> >> FileNames[$UserBaseDirectory <> "\\*"] >> {D:\Math\AddOns\AddOns, D:\Math\AddOns\Applications, >> D:\Math\AddOns\Autoload, \ D:\Math\AddOns\Documentation, >> D:\Math\AddOns\FrontEnd, D:\Math\AddOns\Kernel, \ >> D:\Math\AddOns\Licensing, D:\Math\AddOns\SystemFiles, >> D:\Math\AddOns\User} >> >> But Mathematica does not seem to search within >> D:\Math\AddOns\AddOns, so it never finds >> >> D:\Math\AddOns\AddOns\ExtraPackages\Enhancements >> >> in which I placed RootSearch.m. >> >> Previously, I had tried, instead, to put that ExtraPackages >> tree at the top level of $UserBaseDirectory, so that: >> >> FileNames[$UserBaseDirectory <> "\\*"] >> {D:\Math\AddOns\Applications, D:\Math\AddOns\Autoload, \ >> D:\Math\AddOns\Documentation, D:\Math\AddOns\ExtraPackages, \ >> D:\Math\AddOns\FrontEnd, D:\Math\AddOns\Kernel, >> D:\Math\AddOns\Licensing, \ D:\Math\AddOns\SystemFiles, >> D:\Math\AddOns\User} >> >> Notice that the ExtraPackages directory was in that search >> path, but still Mathematica does not find RootSearch in >> response to command: > > No. It is in your directory heirarchy, but that does not mean that it is in > your search path. Of your FileNames[$UserBaseDirectory <> "\\*"], only > {D:\Math\AddOns\Applications, D:\Math\AddOns\Autoload, > D:\Math\AddOns\Kernel} are in $Path. See below. > >> >> << Enhancements`RootSearch` >> >> The trouble seems to be a lack of parallel in the way >> Mathematica treats >> >> ToFileName[{$TopDirectory, "AddOns", "ExtraPackages"}] >> >> and >> >> ToFileName[{$UserBaseDirectory, "AddOns", "ExtraPackages"}] >> >> in that the former IS on the search path but the latter is not. > > By default (for a Windows system), $Path is defined in > ToFileName[{$InstallationDirectory, "SystemFiles", "Kernel", > "SystemResources", "Windows"}, "sysinit.m"]. > > $Path = > Join[ > { > ToFileName[ {$InstallationDirectory, "AddOns"}, "JLink"], > ToFileName[ {$InstallationDirectory, "AddOns"}, "NETLink"], > ToFileName[ $UserBaseDirectory, "Kernel"], > ToFileName[ $UserBaseDirectory, "Autoload"], > ToFileName[ $UserBaseDirectory, "Applications"], > ToFileName[ $BaseDirectory, "Kernel"], > ToFileName[ $BaseDirectory, "Autoload"], > ToFileName[ $BaseDirectory, "Applications"] > }, > If[ $OperatingSystem === "MacOS", {":"}, {".", HomeDirectory[]}], > { > ToFileName[ {$InstallationDirectory, "AddOns"}, "StandardPackages"], > ToFileName[ {$InstallationDirectory, "AddOns", "StandardPackages"}, > "StartUp"], > ToFileName[ {$InstallationDirectory, "AddOns"}, "Autoload"], > ToFileName[ {$InstallationDirectory, "AddOns"}, "Applications"], > ToFileName[ {$InstallationDirectory, "AddOns"}, "ExtraPackages"], > ToFileName[ {$InstallationDirectory, "SystemFiles","Graphics"}, > "Packages"] > }]; > > As Treat has suggested in another post, you need to Append your $Path to > cope with what you've done. At the risk of suggesting something that may > not work (quite likely, given what you've described above), the file > ToFileName[{$UserBaseDirectory, "Kernel"}, "init.m"] is the place to start. > You can modify the $Path by > $Path = AppendTo[$Path, your_directory_goes_here]. For example, > $Path = AppendTo[$Path, "c:/tmpfiles"] appends "c:\tmpfiles" to the $Path. > Why "/"? Simply because it saves typing "\\". > > I don't see the different directories as a lack of parallel. I see it as an > attempt by WRI to handle what it is installing (in $InstallationDirectory), > as well as what users might install system-wide (in $BaseDirectory) or for > specific users (in $UserBaseDirectory). Perhaps Section A.8 of the online > help is some use? > > Regards, > > Dave. > > > -- DrBob at bigfoot.com www.eclecticdreams.net

**References**:**Re: Re: Re: finding package inExtraPackages`Enhancements`***From:*"David Annetts" <davidannetts@aapt.net.au>