Re: How to store data files in packages
- To: mathgroup at smc.vnet.net
- Subject: [mg103675] Re: [mg103663] How to store data files in packages
- From: Adam Griffith <adamg at wolfram.com>
- Date: Fri, 2 Oct 2009 08:22:52 -0400 (EDT)
- References: <200910011042.GAA23813@smc.vnet.net>
What about something roughly like this:
BeginPackage["MyApplication`Common"];
$ApplicationDir = DirectoryName[FindFile[$Input]];
Begin["`Private`"];
End[];
EndPackage[];
Then a resource file could be accessed as follows:
FileNameJoin[{$ApplicationDir, "Resource Files", "001.tiff"}]
-Adam
Karsten W. wrote:
> Hello,
>
> my packages uses some data files. Currently, I store them in a
> subdirectory "resources" below the package directory and access the
> data via
>
> ToFileName[{$UserBaseDirectory, "Applications", myPackage,
> "resources"}, myDataFileName];
>
> I wonder if this is a portable way. I am afraid it is not, since the
> package may be installed under $BaseDirectory as well. And then there
> is this directory at the same level as "Applications" named
> "ApplicationData"
>
> What is the recommended way to store my data files?
>
> Any hint appreciated,
>
> kind regards,
> Karsten.
>
- References:
- How to store data files in packages
- From: "Karsten W." <karsten.g.weinert@googlemail.com>
- How to store data files in packages