Article View: borland.public.cppbuilder.nativeapi
Article #17436Re: How to get application's directory?
From: Rodolfo Frino - Stargate Softwar...
Date: Mon, 24 Mar 2003 20:53
Date: Mon, 24 Mar 2003 20:53
60 lines
3799 bytes
3799 bytes
> > However, you mentioned and then posted (on my request) > > an example that is completely irrelevant (and that you > > wrongly thought it was relevant) > > It was not irrelvant. It directly proved statements you questioned > earlier - the VCL could and was altering the process's current directory at > runtime, and I gave two very specific tests that proved that. The only > change you made to the project was to call GetCurrentDirectory() once (which > even that was not 100% reliable), whereas I was calling it multiple times to > show that it was indeed being altered over and over at runtime. > > > since I can overcome any internal change to the current directory > > done within the application via either an *unofficial* or an > > *official* start up code. > > By caching the value once at startup and reusing it instead of retrieving it > over and over, of course. That's fine. That was not the point of my sample > project, though. > > > Of course, I cannot overcome an external change > > There already is a proven and well-known way to overcome that 100% reliably, > but you don't seem willing to use it yourself. Using Application->ExeName > is always accurate regardless of any startup code used to spawn the process, > regardless of any internal or external changes to the process at startup or > at runtime. Application->ExeName will always be accurate, agreed. At no point in time I said that I am not willing to use it. I pointed out that by getting the value of the current directory at startup and storing it into a variable, (when no external factors have altered this value previously) and reusing it instead of using GerCurrentDirectory() over and over again, will overcome any calls to GetCurrentDirectory in your example. Clearly you didn't understand this point initially since you said "You can't always rely on that, either, as other controls outside your control, such as TOpenDialog and the FileCtrl controls under the Win3.1 palette, can (and usually do) change the current directory internally " But the method I presented shows that these Win3.1 controls cannot change the ApplicationDirectory value in the example I posted when ApplicationDirectory is set as I shown in the example. Once again that shows me that you failed to understand this point , and that's why I made the modifications to your code so that I could explain it to you. Rodolfo
Technical Details
Message-ID:
<3e7f7927@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e7a7800$1@newsgroups.borland.com> <3e7a8e39@newsgroups.borland.com> <3e7ae7af$1@newsgroups.borland.com> <3e7c7c8c@newsgroups.borland.com> <3e7cc472$1@newsgroups.borland.com> <3e7cd82a@newsgroups.borland.com> <3e7cfd40$1@newsgroups.borland.com> <3e7dba28@newsgroups.borland.com> <3e7e28c5$1@newsgroups.borland.com> <3e7e5a97@newsgroups.borland.com> <3e7e63ae$1@newsgroups.borland.com> <3e7ee719@newsgroups.borland.com> <3e7f426d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,440cb76ba9be739c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-24 13:50:25 PST From: "Rodolfo Frino - Stargate Software" <starcinema@eftel.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e7a7800$1@newsgroups.borland.com> <3e7a8e39@newsgroups.borland.com> <3e7ae7af$1@newsgroups.borland.com> <3e7c7c8c@newsgroups.borland.com> <3e7cc472$1@newsgroups.borland.com> <3e7cd82a@newsgroups.borland.com> <3e7cfd40$1@newsgroups.borland.com> <3e7dba28@newsgroups.borland.com> <3e7e28c5$1@newsgroups.borland.com> <3e7e5a97@newsgroups.borland.com> <3e7e63ae$1@newsgroups.borland.com> <3e7ee719@newsgroups.borland.com> <3e7f426d@newsgroups.borland.com> Subject: Re: How to get application's directory? Date: Tue, 25 Mar 2003 07:53:05 +1100 Lines: 62 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 203.129.132.93 Message-ID: <3e7f7927@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1048541479 203.129.132.93 (24 Mar 2003 13:31:19 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail