Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7614 > unrolled thread

DirectoryStack[] not showing top directory stack item

Started byphillman5 <phillman5@gmail.com>
First post2012-01-06 09:23 +0000
Last post2012-01-07 10:16 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  DirectoryStack[] not showing top directory stack item phillman5 <phillman5@gmail.com> - 2012-01-06 09:23 +0000
    Re: DirectoryStack[] not showing top directory stack item "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2012-01-07 10:23 +0000
    Re: DirectoryStack[] not showing top directory stack item Szabolcs Horvát <szhorvat@gmail.com> - 2012-01-07 10:16 +0000

#7614 — DirectoryStack[] not showing top directory stack item

Fromphillman5 <phillman5@gmail.com>
Date2012-01-06 09:23 +0000
SubjectDirectoryStack[] not showing top directory stack item
Message-ID<je6ei1$qbd$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#7629

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2012-01-07 10:23 +0000
Message-ID<je96fg$j38$1@smc.vnet.net>
In reply to#7614
I don't see this happening in my version (v8/win7-64).

I was just wondering: you say you're using Mathematica 7. How come
your installation directory seems to be that of version 6?

Cheers -- Sjoerd

----
Check out Stackoverflow's Mathematica tag: http://stackoverflow.com/questions/tagged/mathematica
or better, help out with the new dedicated Mathematica Q&A site on
StackExchange.
It's almost in private beta, but needs just a few extra people to kick
off and participate. Go to:
http://area51.stackexchange.com/proposals/37304/mathematica?referrer=EJOMFcZOBpAIDM_9uBjtlA2

On Jan 6, 10:23 am, phillman5 <phillm...@gmail.com> 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

[toc] | [prev] | [next] | [standalone]


#7645

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2012-01-07 10:16 +0000
Message-ID<je9615$iq9$1@smc.vnet.net>
In reply to#7614
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web