worldbank/ietoolkit

`ieboilstart, adopath()` - make sure command works with `net set`

kbjarkefur opened this issue · 4 comments

This feedback was orginally provided by Daniel Klein here.

Investigate how net set relates to the settings done in ieboilstart, adopath().

If the two features cannot be made to work together, then at least make sure that it is well documented that adopath() is cannot be used together with net set.

I was able to reproduce this problem. This example confirms that someone that has set net set ado to something else than PLUS will be able to install commands after using adopath() but the commands are not made available. See reproducible example here:

. * Show default setting
. sysdir
   STATA:  C:\Program Files\Stata17\
    BASE:  C:\Program Files\Stata17\ado\base\
    SITE:  C:\Program Files\Stata17\ado\site\
    PLUS:  c:\ado\plus\
PERSONAL:  c:\ado\personal\
OLDPLACE:  c:\ado\

. adopath
  [1]  (BASE)      "C:\Program Files\Stata17\ado\base/"
  [2]  (SITE)      "C:\Program Files\Stata17\ado\site/"
  [3]              "."
  [4]  (PERSONAL)  "c:\ado\personal/"
  [5]  (PLUS)      "c:\ado\plus/"
  [6]  (OLDPLACE)  "c:\ado/"

. net query
from    http://www.stata.com
ado     c:\ado\plus\
other   (current directory)

. 
. * Simulate user with special folder set in "net set ado" 
. local notplus "C:\ado\not-plus-folder"

. cap rmdir "`notplus'"

. cap mkdir "`notplus'"

. sysdir set  OLDPLACE "`notplus'"

. net set ado OLDPLACE

. 
. * Show current setting
. net query
from    http://www.stata.com
ado     C:\ado\not-plus-folder\
other   (current directory)

. adopath
  [1]  (BASE)      "C:\Program Files\Stata17\ado\base/"
  [2]  (SITE)      "C:\Program Files\Stata17\ado\site/"
  [3]              "."
  [4]  (PERSONAL)  "c:\ado\personal/"
  [5]  (PLUS)      "c:\ado\plus/"
  [6]  (OLDPLACE)  "C:\ado\not-plus-folder/"

. 
. * Use adopath()
. ieboilstart, v(14.1) adopath("C:\ado\project-ado",strict) veryquietly

. 
. * Show current setting
. adopath
  [1]  (BASE)      "C:\Program Files\Stata17\ado\base/"
  [2]  (PLUS)      "C:\ado\project-ado/"

. net query
from    http://www.stata.com
ado     C:\ado\not-plus-folder\
other   (current directory)

. 
. * Install iefieldkit
. ssc install iefieldkit
checking iefieldkit consistency and verifying not already installed...
all files already exist and are up to date.

. 
. * command not availible despite just installed.
. iefieldkit
command iefieldkit is unrecognized
r(199);

All these settings including net set ado do indeed reset after restarting Stata. Here is output after restarting Stata after running the code above.

* Show default setting
. sysdir
   STATA:  C:\Program Files\Stata17\
    BASE:  C:\Program Files\Stata17\ado\base\
    SITE:  C:\Program Files\Stata17\ado\site\
    PLUS:  c:\ado\plus\
PERSONAL:  c:\ado\personal\
OLDPLACE:  c:\ado\

. adopath
  [1]  (BASE)      "C:\Program Files\Stata17\ado\base/"
  [2]  (SITE)      "C:\Program Files\Stata17\ado\site/"
  [3]              "."
  [4]  (PERSONAL)  "c:\ado\personal/"
  [5]  (PLUS)      "c:\ado\plus/"
  [6]  (OLDPLACE)  "c:\ado/"

. net query
from    http://www.stata.com
ado     c:\ado\plus\
other   (current directory)

Solution is probable to include net set ado PLUS before these lines:

* If strict is used, the replace plus
sysdir set PLUS `"`apath'"'
adopath ++ PLUS
adopath ++ BASE

I will test when we are done reorganizing the run folder here: #336

I will keep the minor bug label despite this is a breaking bug because the case is rare. Since the bug is possible we should address, but I do not see a reason for a hotfix release.