[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MSVC patch: "cd" to root dir
From: |
Michael Goffioul |
Subject: |
Re: MSVC patch: "cd" to root dir |
Date: |
Sun, 14 Jan 2007 18:32:20 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (Windows/20061207) |
Bill Denney a écrit :
If I'm reading this correctly, you're wanting to make
chdir("c:")
change your directory to c:\. Is that right?
If that is correct, then I don't think that is proper behavior. The
way that the dos prompt handles this is that you change to the current
directory on that drive, so if you're in c:\octave, and you type "cd
d:\temp" you will go directly to the d:\temp directory. If you go
back to the c drive by typing "cd c:" you will end up in c:\octave.
This is the way that the dos prompt handles it, and I think that we
should be consistent with that.
No the problem is that, within current octave, you can't "cd" to root
dir, either
explicitely, with "cd C:\" or relatively with "cd ..". For instance, if
you're in C:\Octave
and type "cd ..", this won't work. The problem is that internally,
octave will translate
your command into "chdir("C:")" and this won't have any effect on your
current dir,
because of the missing backslash (octave strips down explicitely ending
file seps before
calling chdir()).
This is a common "pattern" under Win32, when dealing with path: for
non-root dirs,
there's no ending backslash, for root, there's a ending backslash.
So my patch is only to make sure that when calling chdir("C:") (which
can happen
if you type "cd .." and you're in C:\Octave), the ending backslash is
automatically
appended. As a side effect, typing "cd C:" will get you to the root
folder. But I
don't think this is such a problem.
Michael.