Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetDir( )

0 views
Skip to first unread message

Tim Stone

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
I'm having a problem with GetDir( ) in a Win '98 system, but the exact same
program runs fine in NT.

The code seeks the default drive / directory:

GetDir( 0, s )

In NT it returns: D:\DEFAULT

In 98 it returns: C:\

The routine is being run in D:\DEFAULT

Does anyone have any ideas on this ?

Thanks

Tim

Paul

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
If I knew why you were doning this I might be able to help...

There are a number of differences between OS's...

Paul.

On Wed, 10 May 2000 01:44:54 GMT, "Tim Stone" <tims...@mstrlink.com>
wrote:

Tim Stone

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
Paul,

I found the problem, and it is interesting. First, I am doing this because
I want to write some files in the default directory. They are temporary and
then discarded.

When Install Shield installed the program, it did not set the working
directory, only the command line. So, even though the program existed on
the D drive, when it was run, it was placing everything in C:'s root.
Correcting the working directory solved the problem.

Tim

"Paul" <pa...@nospam.com> wrote in message
news:39195473...@news.indigo.ie...

Nick Ring

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
Just a thought but what about GetCurrentDir()??

Nick

aak

unread,
May 12, 2000, 3:00:00 AM5/12/00
to
According to my experiences there is a difference between
diffent versions of Windows 98.
Win 98 Second Edition SEEMES to be more stable than Win 98.

I have had the same experiences with programs I have made,
in one version...no problems, in another version...error.

If "s" is defined as String, then your program should work,
according to the documentation of "GetDir(0,s)".

There is however, an extra instruction you could use.
The dis-advantage is that the program allways will start in
this directory - IF the directory exists.

Procedure xxxx;

Begin

{$i-}

ChDir('d:\default');

{$i+}

....

End;

When you use the compiler directives {$i-} and {$i+} you
should test "IOError". If you don't, the system COULD be
unstable. A call to IOError is enough (i.e. Error:=IOError).
Error should be defined as Integer, as IOError could return
a negative number.

aak.

* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful

M.H. Avegaart

unread,
May 12, 2000, 3:00:00 AM5/12/00
to
Why not use the real Window temp directory ?

function GetTempDir: String;
var
Buffer: array[0..MAX_PATH] of Char;
begin
SetString(Result, Buffer, GetTempPath(SizeOf(Buffer), Buffer));
end;


"Tim Stone" <tims...@mstrlink.com> schreef in bericht
news:GReS4.190314$bm.9...@news1.alsv1.occa.home.com...

Maynard Philbrook

unread,
May 12, 2000, 3:00:00 AM5/12/00
to Tim Stone
it may have something to do with how you are setting up the shortcuts and paths
..
if your looking for the programs EXE file path then just use the "Paramstr(0)"
this will return the
programs starting path and file name.
To extract only the path..
extractPath(paramstr(0));
0 new messages