comp.lang.ada
 help / color / mirror / Atom feed
From: Christoph Grein <christoph.grein@eurocopter.de>
To: comp.lang.ada@ada.eu.org
Subject: Re: Gnat 3.13p: Command_Name RM A.15
Date: Fri, 19 Jan 2001 08:26:54 +0100 (MET)
Date: 2001-01-19T08:26:54+01:00	[thread overview]
Message-ID: <mailman.979889652.31022.comp.lang.ada@ada.eu.org> (raw)

Robert Dewar wrote:

> > Open the file with the name given by Command_Name, call the
> > Name function which
> > by A8.2(22) must return the full name, then close the file
> again:
> 
> This obviously does NOT work if the file is not in the current
> directory, which for an executable file is likely. Writing a
> program that only works if its executable is in the current
> directory is defintely very bad practice, so this "solution"
> cannot be recommended.

OK, I'm talking of Win98/NT only,where it works also for relative paths.

Call My_Executable, which is on drive C: at the relative path ..\X\
from drive E directory A:

E:\A> C:..\X\My_Executable

On Win98, Command_Name returns  C:\Full_Path\X\My_Executable.exe
on WinNT, it returns C:..\X\My_Executable

Open works with both strings (OK I have to first add the extension .exe if not 
present, and I know it must be .exe and nothing else), and Name returns the 
desired result: C:\Full_Path\X\My_Executable.exe

> There is no general way of getting the full path of the
> current executable if it is not availabel in arg(0), which
> is why this cannot be guaranteed.

I did not claim that this works on all conceivable OSs.

Christoph Grein





             reply	other threads:[~2001-01-19  7:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-19  7:26 Christoph Grein [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-01-18 12:10 Gnat 3.13p: Command_Name RM A.15 Schroeer, Joachim Dr.
2001-01-18 12:19 ` Lutz Donnerhacke
2001-01-18  6:59 Christoph Grein
2001-01-18 12:38 ` Larry Kilgallen
2001-01-18 14:32   ` Marin David Condic
2001-01-18 14:54   ` Ted Dennison
2001-01-18 15:12 ` Robert Dewar
2001-01-16  6:12 Christoph Grein
2001-01-16 14:22 ` Marin David Condic
2001-01-16 18:14   ` Jean-Pierre Rosen
2001-01-17 13:15     ` Marin David Condic
2001-01-17 19:12       ` Jean-Pierre Rosen
2001-01-18  3:28         ` Robert Dewar
2001-01-18 13:23           ` Marin David Condic
2001-01-18 15:15             ` Robert Dewar
2001-01-18 17:37           ` Jean-Pierre Rosen
2001-01-19 20:31             ` Florian Weimer
2001-01-18  3:25       ` Robert Dewar
2001-01-18 14:06         ` Marin David Condic
2001-01-17 19:17   ` Stephen Leake
2001-01-18  3:31     ` Robert Dewar
2001-01-18 14:13       ` Marin David Condic
2001-01-18 15:16     ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox