I don't think that -ado- or -net- support anything like this. The only
possibility (other than StataCorp changing -ado- and -net-) is to
provide your own versions of -ado- and -net- such as
prog mynet
gettoken subcmd 0 : 0
net `subcmd' `0'
if `"`subcmd'"'==substr("install",1,max(3,strlen(`"`subcmd'"'))) {
gettoken pkgname : 0
capture `pkgname'_on.ado
}
end
The program for -ado- would be slightly more complicated because the
input can also be a package id. There will also be other details to
take care of such as the -from()- option in ado.
An issue is that -net- and -ado- are totally silent (i.e. they do not
return any results) which makes it difficult to deal with them.
Maybe a look at the code of -adolist- will be helpful (-ssc d adolist-).
ben
On Mon, Oct 20, 2008 at 8:37 PM, Sergiy Radyakin <[email protected]> wrote:
> Dear All,
>
> I have a command that creates some files during it's work, which in
> their nature are neither temporary, nor permanent. (They exist more
> than one session). They are created when the program is first launched
> and changed occasionally after. An example may be a config file, which
> determines the mode of use of the command (in reality things are more
> complicated, a dummy config file could be simply supplied with the
> package). I don't want to leave a mess on the user's computer and when
> [s]he uninstalls the package with -ado uninstall foobar- I want to
> clean up and remove all of these `temporary' files.
>
> Q: is there any way how I can provide an uninstall routine, that will
> be called by Stata when the user issues -ado uninstall foobar- ? (I
> prefer to avoid instructing "Don't forget that you can't remove this
> package like any other package and must first call -foobar_uninst- and
> then -ado uninstall foobar-).
>
> Earlier I asked about the possibility of receiving control immediately
> after the package is installed (e.g. to add a command to the menu).
> This request is symmetric, but with regard to uninstallation.
>
> Ideally, I would want to include into the package two files, e.g
> foobar_on.ado and foobar_off.ado and have Stata's -ado- execute the
> first after -foobar- is installed and the second before it is
> uninstalled.
>
> Thank you,
> Sergiy Radyakin
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/