RE: Current Directory
- Posted by Brendon Sly <bwsly at infoscience.otago.ac.nz> Feb 13, 2003
- 513 views
> -----Original Message----- > From: Derek Parnell [mailto:ddparnell at bigpond.com] > Subject: Re: Current Directory > Hi Derek, <enormous snip> > > 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. I've no idea how you'd do a generic solution that'd work on anything, but.. I had to do something like this a while back but since my app was being called from a batch file, I could 'cheat' and make use of the 'chdir' command. If you type 'chdir X:' (where X is the drive you're interested in) at a DOS prompt, it'll return the current directory for that drive, according to that DOS session. My function did a simple system call something like: system(sprintf("chdir %s > %s", {drive_letter, temp_filename}), 2) I'd then read the single line in that file and use that instead of, in my case, 'M:' or 'N:'. I used that simple trick to deal with a whole bunch of files in a batch process on Win2000 and I could avoid messing with the current drive/directory, which would have broken the 'main' batch file. > ---------------- > cheers, > Derek Parnell Cheers. Brendon