[fpc-pascal]chdir problem? -- 2nd request
Kuba Ober
winnie at hoth.amu.edu.pl
Wed Jan 10 16:46:24 CET 2001
On Tuesday 09 January 2001 09:35 am, you wrote:
> > This is no permanent directory, either, but the very same you have
> > in your own programs. While a program is running, let that be a
> > small utility, an complex application or a command interpreter,
> > there is a current directory it keeps. Whenever you issue that CD
> > command, you change the current directory of *that copy* of
> > CMD.EXE, nothing else. If you have several DOS prompts running,
> > they will not influence each other and as soon as you exit any of
> > them, the current directory vanishes with the program. There is
> > simply no way to solve this otherwise in a multitasking operating
> > system.
> >
> > But you could tell us why you want to modify the current directory
> > of a program from another one (as far as I can tell, this is what
> > you actually aim to do). We might come up with an alternative
> > solution.
>
> With all the confusion I seem to have created perhaps the problem is that I
> haven't properly stated my intentions. This is what I'm trying to do:
>
> I have a command line (text-mode) filefind type of program that I
> developed. You know; search by date, time, size, attribs, etc. One of the
> options is 'goto directory' of the found file. So, you can search for
> anyfile.name and have it find the file, CD into the directory where the
> file is and then exit (leaving you at the DOS prompt, but in the directory
> of the file you were searching for). The go32 targets work just fine, but
> the Win32 targets leave you in the directory that the program was launched
> from and not the directory where the file was found.
And that's how it's meant to be since in DOS (say go32) your program affects
the currently running copy of DOS in the particular virutal machine.
The windows executable runs SEPARATE from the DOS virtual machine and
whatever you change in it stays there and ONLY there. Windows executable
doesn't even know (or care) if it was fired from DOS window or by exec call.
That's about multiprocessing. DOS doesn't have a hint about it, and please
bear this in mind. Don't expect Linux and Windows to emulate brokenness of
DOS. Nuff said.
Cheerz.
Kuba
More information about the fpc-pascal
mailing list