I want to search the stata.trk file for a package (see motivation below if interested)
I can find the file easily enough
Am I missing some subtlety of stata or the shell behavior?
There is a work around, if I copy the file to my default directory. (which shows further that "copy" works while "ls" does not)
(motivation: I want to automate installation of necessary packages for users of a do file.
while the command "which" can find if ado files are installed, as far as I can tell you can not find if a package is installed without searching for one of the component ado files.
In my program I'd rather just supply a list of packages and then "ssc install <package>" if missing, rather than have to keep track of two lists: one of component ado files to check if installed and then a second of packages to install if the corresponding component ado files are missing)
I am using stata version 14.1 in osx 10.11.2
I can find the file easily enough
. findfile stata.trkHowever the "type" command has no trouble
~/Library/Application Support/Stata/ado/plus/stata.trk
. di `"`r(fn)'"'
~/Library/Application Support/Stata/ado/plus/stata.trk
but the filefilter command can not find the file
. filefilter `"`r(fn)'"' temp.trk,from(moremata.pkg)
file ~/Library/Application Support/Stata/ado/plus/stata.trk not found
r(601);
. type `"`r(fn)'"',lines(5)Other commands do have the same problem
* 00000139
*! version 1.0.0
* Do not erase or edit this file
* It is used by Stata to track the ado and help
* files you have installed.
. findfile stata.trk
~/Library/Application Support/Stata/ado/plus/stata.trk
. ls `"`r(fn)'"'
ls: ~/Library/Application Support/Stata/ado/plus/stata.trk: No such file or directory
Am I missing some subtlety of stata or the shell behavior?
There is a work around, if I copy the file to my default directory. (which shows further that "copy" works while "ls" does not)
. findfile stata.trkWhich gives me what I want - the number of occurrences of moremata.pkg in my ado tracking file. I can certainly use this work-around, but the behavior in access to files seems erratic and likely to trip one up in programming, unless someone can explain the rule that I am missing.
~/Library/Application Support/Stata/ado/plus/stata.trk
. copy `"`r(fn)'"' test.trk
. filefilter test.trk temp.trk,from(moremata.pkg)
. return list
scalars:
r(occurrences) = 1
r(bytes_from) = 12
r(bytes_to) = 0
(motivation: I want to automate installation of necessary packages for users of a do file.
while the command "which" can find if ado files are installed, as far as I can tell you can not find if a package is installed without searching for one of the component ado files.
In my program I'd rather just supply a list of packages and then "ssc install <package>" if missing, rather than have to keep track of two lists: one of component ado files to check if installed and then a second of packages to install if the corresponding component ado files are missing)
I am using stata version 14.1 in osx 10.11.2
Comment