MathGroup Archive 2012

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

Search the Archive

Re: DirectoryStack[] not showing top directory stack item

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124038] Re: DirectoryStack[] not showing top directory stack item
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sat, 7 Jan 2012 05:15:38 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <je6ei1$qbd$1@smc.vnet.net>

On 2012.01.06. 10:23, phillman5 wrote:
> Looking at the on line help for DirectoryStack it shows the following
> example:
>
> SetDirectory[$InstallationDirectory]
>    "C:\Program Files\Wolfram Research\Mathematica\6.0"
>
> DirectoryStack[]
>     {"C:\Program Files\Wolfram Research\Mathematica\6.0",
>     "C:\Program Files\Wolfram Research\Mathematica\6.0\Documentation\
>     English\System\ReferencePages\Symbols", "C:\Documents and
>     Settings\roger\My Documents"}
>
> However when I request a DirectoryStack it never shows the top item
>
> SetDirectory[NotebookDirectory[]]
>    /Volumes/RamDisk/D1 line<--this is correct
>
> DirectoryStack[]
>    "/Users/phillman5"<- missing new stack
> value set above
>
> However if I do a Directory[] I do get the top entry
>
> Directory[]
>    /Volumes/RamDisk/D1 line
>
> On starting Mathematica it shows that the DirectoryStack is empty.
>
> Also  ResetDirectory[] shows the resulting top DirectoryStack item,
> not the one popped.
>
> I am using Mathematica 7.0.1.0 on Mac OSX 10.6.8
>

Directory[] gives you the current directory.

If you do SetDirectory[...], the previous directory is stored in 
DirectoryStack[], then the value of Directory[] is changed.

So in a fresh kernel DirectoryStack[] is always supposed to be empty 
({}).  DirectoryStack[] will never contain the *current* value of 
Directory[], only the *previous* ones.

I hope this clarifies how it works.

Most of the time you don't need to access DirectoryStack[], and can just 
use SetDirectory[] and ResetDirectory[].  Are you having any 
difficulties with these two functions?

-- 
Szabolcs Horvát
Mma QA site proposal: http://area51.stackexchange.com/proposals/37304



  • Prev by Date: find data
  • Next by Date: Re: Rule replacement doesn't work after NDSolve?
  • Previous by thread: DirectoryStack[] not showing top directory stack item
  • Next by thread: Re: DirectoryStack[] not showing top directory stack item