# Can I place a link to a package file (.m) in my Applications folder

I am developing a package and would like to be able to test it without having to copy the package file to my $UserBaseDirectory/Applications folder for each change, so it would be convenient for me to just create a Finder link or symlink pointing back to my working file. So far I have not been able to convince Mathematica to treat the link as a package file. Am I missing a subtle technique that may make this possible? - For development purposes, I would just add the location of your file's directory to $Path via AppendTo[$Path, directory-with-your-file] - I think that's simpler. – Leonid Shifrin Apr 18 '13 at 14:26 Wolfram Workbench might be handy too – Spawn1701D Apr 18 '13 at 15:36 ## 1 Answer I had the same problem with the addition, that I have several machines (home, work, laptop) where I develop. What I wanted to have was a GetDev which works like the usual Get with the difference that it looks in my development folder for the package when it cannot not be loaded. Therefore, I'm using the following function GetDev when I want to load my package which is in active development. It consists of two definitions. The first one extracts the dev-folder for the appropriate machine GetDev::unknMach = "The computer 1 is not known as development machine."; GetDev[package_String] := Switch[$MachineName,
"myMachineName",
GetDev[package, FileNameJoin[{$UserDocumentsDirectory, "workspace"}]], _, Message[GetDev::unknMach,$MachineName]
];


Here you can define dev-folders for each machine you have. Then GetDev is called again but with the path to the dev-folder. First it tries to load the package with the normal Get. We suppress the Get::noopen message but use Check to test for it. When the call to Get fails, we append the dev-folder to our $Path and try again. GetDev[package_String, devpath_String] := Module[{}, Quiet[Check[ Get[package], (AppendTo[$Path, FileNameJoin[{devpath,
StringReplace[package, "" -> $PathnameSeparator]}]]; Check[ Get[package], Message[General::noopen, package], {Get::noopen} ]),{Get::noopen}], {Get::noopen}] ];  Some important details: I'm using the usual Wolfram Workbench application structure. So if I develop a package Blub then the code for it is located in mypath/workspace/Blub/Blub. Important are the two nested Blub folders. This is why I'm not simply appending my development folder but instead, I use the package name as folder in this line: AppendTo[$Path, FileNameJoin[{devpath, StringReplace[package, "" -> \$PathnameSeparator]}]


If you are using only one development machine, then you can define the dev-folder to be fixed. Btw, this is only a hacked version. If I would have to write it again, I would add some details like removing the added path, when the package could not be loaded.

-