Re: Current Directory

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

----- Original Message -----
From: "Al Getz" <Xaxo at aol.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Current Directory


>
> Derek,
>
> Because your questions seem very detailed the best thing you can
> do is supply us with a list of file entries (line by line) and
> a comment as to what is supposed to happen with that particular
> entry.  I would say you should supply at least 20 fully commented
> examples.

There are NOT that many possibilities, Al. Here are all the possible
combinations...

a)  <filename>
b)  <relativepath>\<filename>
c)  <absolutepath>\<filename>
d)  <curdrive>:<filename>
e)  <curdrive>:<relativepath>\<filename>
f)  <curdrive>:<absolutepath>\<filename>
g)  <otherdrive>:<filename>
h)  <otherdrive>:<relativepath>\<filename>
i)  <otherdrive>:<absolutepath>\<filename>

Where <filename> includes an optional extention such as ".bat"
   <relativepath> has the form <foldername>[\<foldername>]...
   <absolutepath> has the form \<relativepath>
   <foldername> also include "." and ".." special folders.
   <curdrive> is the drive letter of the Current drive.
   <otherdrive> is a drive letter of a drive that is NOT the current drive.

Here is how I expect them to be resolved...
a)  <curdrive>:<curdir>\<filename>
b)  <curdrive>:<curdir>\<relativepath>\<filename>
c)  <curdrive>:<absolutepath>\<filename>
d)  <curdrive>:<curdir>\<filename>
e)  <curdrive>:<curdir>\<relativepath>\<filename>
f)  <curdrive>:<absolutepath>\<filename>
g)  <otherdrive>:<???>\<filename>
h)  <otherdrive>:<???>\<relativepath>\<filename>
i)  <otherdrive>:<absolutepath>\<filename>

Where <curdir> is the current directory minus the current drive specifier
but includes the leading slash.
      <???> is what I don't know how to find out using standand Euphoria. It
is the current directory for <otherdrive>.

> It would be a good idea to use the format shown in another
> reply:
>
> [line1] D:\ThisDir\ThatDir\file1.txt --file #1, location only
> [line2] D:                           --command
> [line3] D:\ThatDir\file1.txt         --file #2, location only
> [line4] D:ThatDir\file1.txt          --file #2 again
> [line5] blah blah                    --command
>
>
> Some additional comments...
>
> >D:FolderName\..\test2.dat
>
> >Notice that there is NO "\" between the ":" and the "FolderName". This
> >is
> >the situation that I don't know how to handle.
>
> This doesnt sound that hard.  You have to answer the question:
> Does this format differ from the standard format for a reason,
> or should it be converted into: "D:\FolderName\..\test2.dat"?

Yes it does differ for a reason! 'Cos that's how the user entered it. It is
not meant to be transformed by inserting the slash because that would be the
WRONG thing to do.

>
> >Then if D:\XYZZY\test2.dat is supplied, how can I know if that is the
> >same
> >file as D:\FolderName\..\test2.dat ? It is possibly the same file, but
> >maybe not also.
>
> The file cant be exactly the same file, but might be a replica.

You are right. I gave the wrong example. I meant to have said
"D:FolderName\..\test2.dat" and they can be the same file - and I don't mean
a replica or copy. I mean literally the same file. This is basic Microsoft
file syntax.

   D:\XYZZY\test2.dat  ==> The file called "test.dat" can be found on the
'D' drive in the folder called 'XYZZY'.

   D:FolderName\..\test2.dat ==> The file called "test.dat" can be found on
the 'D' drive. First go to the current folder for that drive, then to the
'FolderName' folder, then go to its parent folder. The file can be found
there. Now if it so happened that the current directory for the D drive was
XYZZY then these two file references refer to exactly the same file.

Try this .BAT file in a DOS window.

@echo off
c:
cd \
mkdir test1
echo >test1\file.dat TEST A
d:
cd \
mkdir test2
echo >test2\file.dat TEST B
cd test2
c:
type c:test1\file.dat
type d:file.dat

--------
Note that the current directory for C: is "\" and the current directory for
D: is "\test2". But all I had to do to access the D: file was enter
"D:file.dat".

So how can I find out, using basic Euphoria, what is the current directory
for ANY drive in the system?

I know I can use DOS INT21 command and WinAPI call, but I'd rather avoid
that if possible.

----------------
cheers,
Derek Parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu