Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Getting File Directory Using Any Platform

  • To: mathgroup at
  • Subject: [mg34023] Re: [mg34013] Getting File Directory Using Any Platform
  • From: John Fultz <jfultz at>
  • Date: Sat, 27 Apr 2002 00:56:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

A *much* easier (not to mention highly reliable) way to do this is...

ToFileName[{$TopDirectory, "AddOns", "ExtraPackages", "Utilities"},

And with this method, you don't have to worry about silly typos
like the one in your Macintosh case.


John Fultz
jfultz at
User Interface Group
Wolfram Research, Inc.

> I want a line of code that will return the directory where the Notation
> package is located and it should return a result consistent with the
> operating system used.  If the following doesn't work on your platform
> please let me know. I am also interested in any improvements to this code. 
> In[1]:= 
>   dirs=Which[
>     $System==="Microsoft Windows","\\AddOns\\ExtraPackages\\Utilities",
>     $System==="Machintosh",":AddOns:ExtraPackages:Utilities",
>     True (* Unix *), "/AddOns/ExtraPackages/Utilities"
>   ];
>   DirectoryName[$TopDirectory<>dirs<>"Notation.m"]
> Out[1]=
>    C:\Program Files\Wolfram Research\Mathematica\4.1\AddOns\ExtraPackages\
> ------------
> Thanks, 
>   Ted Ersek
>   Get Mathematica tips, tricks from

  • Prev by Date: Re: passing functions as parameters
  • Next by Date: Re: Test of a pure function
  • Previous by thread: RE: Getting File Directory Using Any Platform
  • Next by thread: Re: Getting File Directory Using Any Platform