RE: Current Directory

new topic     » goto parent     » topic index » view thread      » older message » newer message

DOS maintains a current directory structure for each drive, so each DOS
box is likely to maintain its own such array of directory names.
	Look at Ralf Brown's interrupt encyclopedia. There is an int 0x21 call
that returns this inforation (don't remember it right now, but the value
in ah lies between 0x39 and 0x47), and also a call to canonicalize path
names, including UNC, in the way you seem to want (int 0x21 ah=0x60). 
	Sorry, this is direct interrupt calling, but, since the OS provides for
the feature itself, why perform double work? Sure, it would be nice
(Open)Eu be able to retrieve this.

	CChris


> ------------------------------
> 
> Date: Wed, 12 Feb 2003 10:51:07 +0000
> From: Al Getz <Xaxo at aol.com>
> Subject: RE: Current Directory
> 
> Derek Parnell wrote:
> > In Windows and DOS environments, how can I get Euphoria to tell me the
> > current directory of a drive that is not the current drive?
> >
> > My understanding is that each drive in a DOS/Windows system has its own
> > current directory setting. I know that current_dir() will give me the
> > directory that I started running the Euphoria program from, but how do I
> >
> > find the current diretory of any of the other drives.
> >
> > If possible, I'd prefer NOT to use a Windows API or DOS interrupt to get
> >
> > the info.
> >
> > In fact, what I'm trying to do is write a function that is given a
> > filepath
> > string, and have it return the same path but in standardized - full -
> > form.
> > This should take into consideration any ".\" and "..\" and leading
> > "DRIVE:"
> > combinations. I've almost succeeded except for paths given in the form
> > ...
> >
> >     P:myfolder\myfile.abc
> >
> > I know the drive "P:" but the rest is supplied relative to the current
> > directory *on that drive*! And now I need to know how to get that info.
> >
> > Maybe somebody has already got a neat function that does all this (hint,
> >
> > hint).
> >
> > I'm not even going to try network paths yet blink
> > --
> >
> > cheers,
> > Derek Parnell
> >
> >
> Hello there,
> 
> Is there really such a thing in general?
> 
> After all, if you open a dos window and at the c:\> prompt type
> D:\
> and then type
> cd "Euphoria"
> 
> then type
> C:
> you get the C prompt back, and then type
> D:
> you get the D prompt with the previous 'switched to' directory
> "D:\Euphoria>"
> (as expected)
> 
> BUT
> 
> if you leave that window open and open another dos window and
> at the C prompt type
> D:
> you get
> "D:\>"
> even though the previous dos window still shows "D:\Euphoria>"
> which means there is no such thing as a 'system wide' current
> directory for each drive and that the current directory is
> particular to the process only.
> This also implies that each process can have it's own current
> directory which has nothing to do with the other processes'.
> 
> As is you cant run multiple statements with the 'system' command
> like:
> system("doscommand1,doscommand2, doscommand3",0)
> either, which ideally would run several commands in the
> same dos window.
> 
> If you try using a .bat file im pretty sure once the bat file
> stops running all the current directory info is lost anyway,
> so you would have to do all the work within the bat file.
> 
> There is nothing to stop you from starting your own 'driver'
> that will keep track of 'current directories' for each drive
> (of course you will have to override a few functions prepending
> the current directory),
> but i think if you look into the original problem you will
> find a better way to do it overall then having to deal with
> multiple current directories.
> 
> What is the original problem that prompted you to look for
> the 'current directory' for each drive?
> 
> Let us know what you end up doing.
> 
> Take care,
<snip>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu