[M3devel] how to find cm3.cfg

Jay K jay.krell at cornell.edu
Mon Aug 31 03:10:55 CEST 2009


how to find cm3.cfg

 

 

I propose, in this order:

  -  -config or --config switch (actually any number of dashes) 

  - $M3_CONFIG environment variable (however it is already spelled) 

     This is a preferably path to a specific file, not some directory to further probe. 

     I'll have to check the current implementation though. It might be 

     a directory containing cm3.cfg as well. Whatever it currently does is how it should likely stay. 

  - cm3.cfg next to executable, be it cm3.exe, cm3ide.exe, etc. 

  - possibly one other choice, if none of the above exist, and executable is not cm3/cm3.exe, 

   then search $PATH for cm3/cm3.exe and use cm3.cfg next to it 

 

This includes NOT looking in:

  - /etc 

  - current directory 

  - $PATH in general 

 

 

One problem is, you can't really directly/easily even find the current executable in Posix.

I'll do more research on this.

It is easy in Win32 and I assume Mac.

Otherwise will probably fall back to:

 

 

I believe everyone's best effort here is looking at argv[0] and if that isn't a full or

current working directory relative path, search $PATH.

 

 

Any other search should be layerable upon this.

That is, cm3.cfg can include(/etc/cm3.cfg) or such.

 

 

One thing not accounted for here is a --target command line option.

Given the current layout and code, that doesn't work out well.

Specifically, using config/target wouldn't set INSTALL_ROOT correctly.

--target could set $TARGET and cm3.cfg could include config/target if

target is already set.

Or cm3 could set INSTALL_ROOT itself.

 

 

We could look for next-to-executable/target.cfg.

 

 

I think I'll punt on all this for now -- any accomodation of --target on command line.

 

 

I think this change should probably go in this release, given that there was another change

already that this undoes and given th bug I found regarding running by relative path (granted,

I should debug that before replacing the code).

 

Or, I guess, at the very least, remove the new probes and fix the bug I found.

I guess.

 

 - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090831/dd28dafe/attachment-0001.html>


More information about the M3devel mailing list