🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17438

Re: How to get application's directory?

#17438
From: Remy Lebeau (TeamB)
Date: Mon, 24 Mar 2003 22:14
45 lines
3456 bytes
"Rodolfo Frino - Stargate Software" <starcinema@eftel.com> wrote in message
news:3e7f7927@newsgroups.borland.com...

> 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.

I never refuted that.  I did agree to it, in fact.

> Clearly you didn't understand this point initially

Yes, I did catch that point, and commented as such.

> 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.

That was never in debate.  My whole point originally was that
GetCurrentDirectory() is influenced at runtime, and should not be relied on.
My sample proved that.  You altered the sample to cache the value instead,
and I agreed that was fine to do in general, but that was not the focus of
the original sample to begin with.

However, your sample *IS* effected by external changes at startup, and that
one simple fact alone makes your sample unreliable and fairly useless, as
you don't have any way of knowing ahead of time that GetCurrentDirectory()
has already been influenced before your code has a chance to use it the
first time.  Unless you use TApplication::ExeName as well and compare the
two values to see if they differ, at which point you're better off just
using ExeName to begin with since you're calling it anyway.  Which is why
GetCurrentDirectory() is very rarely, if ever, recommended when people ask
such questions as "how do I get my application's directory?".  It's useless
for that specific purpose.  It has other purposes it is designed more for,
so its is not a useless function in general, however.

> Once again that shows me that you failed to understand this point

Please re-read my earlier comments more closely...


Gambit
Technical Details
Message-ID: <3e7f810d@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-mail
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> <3e7f7927@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 14:07:40 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.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> <3e7f7927@newsgroups.borland.com>
Subject: Re: How to get application's directory?
Date: Mon, 24 Mar 2003 14:14:50 -0800
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e7f810d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048543501 207.175.226.26 (24 Mar 2003 14:05:01 -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