Re: Getting File Directory Using Any Platform

*To*: mathgroup at smc.vnet.net*Subject*: [mg34027] Re: [mg34013] Getting File Directory Using Any Platform*From*: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>*Date*: Sat, 27 Apr 2002 00:56:31 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Sorry, I was to hasty with "thirdly". It does not work on Windows and Mac OS. However, the following should work on all platforms: In[5]:= ToFileName[{$TopDirectory,"AddOns","ExtraPackages","Utilities"}] Out[5]= /Applications/Mathematica 4.1.app/AddOns/ExtraPackages/Utilities/ Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Friday, April 26, 2002, at 06:52 PM, Andrzej Kozlowski wrote: > First of all, Macintosh, not Machintosh. Secondly, this will not work on > > In[1]:= > $System > > Out[1]= > Mac OS X > > And thirdly, why not use simply: > > In[2]:= > ToFileName[$TopDirectory<>"/AddOns/ExtraPackages/Utilities/"] > > Out[2]= > /Applications/Mathematica 4.1.app/AddOns/ExtraPackages/Utilities/ > > ?? > > > > On Friday, April 26, 2002, at 04:27 PM, Ersek, Ted R wrote: > >> 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 >> http://www.verbeia.com/mathematica/tips/Tricks.html >> >> >> >> >