Thread overview
[Issue 4585] New: DMD2 should look for dmd2.conf
Aug 05, 2010
Leandro Lucarella
Aug 06, 2010
Sobirari Muhomori
Aug 06, 2010
Leandro Lucarella
Aug 06, 2010
Jacob Carlborg
Aug 06, 2010
Sobirari Muhomori
August 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585

           Summary: DMD2 should look for dmd2.conf
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: llucax@gmail.com


--- Comment #0 from Leandro Lucarella <llucax@gmail.com> 2010-08-05 06:51:45 PDT ---
If you want to have both dmd1 and dmd2 installed, the fact that both binaries look for the same dmd.conf file is a big complication. It would be nice is dmd2 looked for dmd2.conf instead (or at least look for both, but fist for the dmd2.conf).

Naming the binary dmd2 could be nice too, but that can be done by the user, changing what config files to search is not possible.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com


--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-08-05 07:01:34 PDT ---
Better idea:

argv[0] ~ ".conf"

Then you can have things like:

dmd-2.047.conf
dmd-2.041.conf

etc.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585



--- Comment #2 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2010-08-05 19:50:20 PDT ---
Does argv[0] contain full path to the binary?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585



--- Comment #3 from Leandro Lucarella <llucax@gmail.com> 2010-08-05 20:27:58 PDT ---
(In reply to comment #2)
> Does argv[0] contain full path to the binary?

No, at least on unix, is the same command you typed, but you can always do basename(argv[0]) and search for that file where the dmd binary (which is already searched by DMD) is, and the other search paths.

So I think is a viable option. I find a little odd that the config file changes if you change the binary name, but I can see how it can be pragmatic.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585



--- Comment #4 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-08-06 04:41:09 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > Does argv[0] contain full path to the binary?
> 
> No, at least on unix, is the same command you typed, but you can always do basename(argv[0]) and search for that file where the dmd binary (which is already searched by DMD) is, and the other search paths.

Yes, you can find the path to the binary, or at least the command being run (if its a symlink) by searching the PATH.  I think DMD already must do this, because argv[0] is pretty much what's available to find the executable directory in the first place.

> So I think is a viable option. I find a little odd that the config file changes if you change the binary name, but I can see how it can be pragmatic.

Often, I have several dmd2 compilers that I want to test because I'm working on bugs in phobos or because I want to know where a regression happened. Currently, I have to specify the full path to the exe, it would be nice to just have them all live in the same directory, and I could then put that dir in my path.

So your original solution wouldn't work for this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585


Jacob Carlborg <doob@me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob@me.com


--- Comment #5 from Jacob Carlborg <doob@me.com> 2010-08-06 05:31:29 PDT ---
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > Does argv[0] contain full path to the binary?
> > 
> > No, at least on unix, is the same command you typed, but you can always do basename(argv[0]) and search for that file where the dmd binary (which is already searched by DMD) is, and the other search paths.
> 
> Yes, you can find the path to the binary, or at least the command being run (if its a symlink) by searching the PATH.  I think DMD already must do this, because argv[0] is pretty much what's available to find the executable directory in the first place.

There are system functions to get the path to the currently running executable. I made a function for this to Tango that works on Windows, Linux, Mac OS X and FreeBSD: http://dsource.org/projects/tango/attachment/ticket/1536/process.d . I'm willing to license the code to whatever license necessary for inclusion in dmd.

> > So I think is a viable option. I find a little odd that the config file changes if you change the binary name, but I can see how it can be pragmatic.
> 
> Often, I have several dmd2 compilers that I want to test because I'm working on bugs in phobos or because I want to know where a regression happened. Currently, I have to specify the full path to the exe, it would be nice to just have them all live in the same directory, and I could then put that dir in my path.
> 
> So your original solution wouldn't work for this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585



--- Comment #6 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-08-06 05:35:08 PDT ---
(In reply to comment #5)
> There are system functions to get the path to the currently running executable. I made a function for this to Tango that works on Windows, Linux, Mac OS X and FreeBSD: http://dsource.org/projects/tango/attachment/ticket/1536/process.d . I'm willing to license the code to whatever license necessary for inclusion in dmd.

Thanks for the offer.  But I'd rather not get the exact executable.  I used to use symlinks to trick dmd into thinking it was in another directory, I don't want to disable that by having dmd ignore the symlink location.

But your offer is generous, and probably would be good to have in phobos.  I will keep it in mind! (Phobos' process is due for an update but is blocked by a nasty compiler bug)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4585



--- Comment #7 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2010-08-06 13:15:18 PDT ---
You either want them to be in one directory or in different.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------