MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NotebookDirectory for package (.m) files?

  • To: mathgroup at
  • Subject: [mg110466] Re: NotebookDirectory for package (.m) files?
  • From: Albert Retey <awnl at>
  • Date: Sun, 20 Jun 2010 03:43:37 -0400 (EDT)
  • References: <hviao8$h51$>


> i would like to create an application package that included a data
> directory that can should be accessable for commands in the
> application. Of course I can hard-code the path in my .m file but what
> is the proposed way to do this in case I would like to provide the
> package to other users which might install the package in a completely
> different directory?

Actually I don't know if or what the recommended way to handle this is,
but what I have done and what seems to work but is a little complicated
is this:

1) find where your package is installed (Assuming your package is called
MyPackage and will be loaded with e.g. Needs["MyPackage`"]):


2) now construct the path to your data directory from that path and save
it to a global variable:


there are some pitfalls like which package will be used if you happen to
have more than one installed etc., which you might want to handle or not...



  • Prev by Date: Re: defining a function of functions
  • Next by Date: Re: Bar chart style with ListPlot
  • Previous by thread: NotebookDirectory for package (.m) files?
  • Next by thread: Re: NotebookDirectory for package (.m) files?