[texworks] Scripting: Get permissions for scripts
st.loeffler at gmail.com
Sun Jul 1 17:35:54 CEST 2012
On 2012-06-22 10:48, Henrik Skov Midtiby wrote:
> In the TeXworks preferences dialog -> Scripts, it is possible to set
> different permissions related to script execution.
> Is it possible to get information about which of these permissions
> that are granted to a running script?
Yes, and no. There are no dedicated functions to query the permissions
for a script (that can be called from within the script). Partly, this
is due to the fact that reading and writing is context-sensitive (e.g.,
scripts are allowed to read files in the scripts/ folder, but may not be
allowed to read other files).
However, the respective functions that require special permissions will
fail with a special return code (SystemAccess_PermissionDenied=2) in
case permissions are insufficient.
> Ideally I would like to present users with a message like "Grant
> permission to run system commands for enabling filename completion" if
> a certain permission is not set.
Well, the typical use case would be to try to run the command, and if
that fails with SystemAccess_PermissionDenied, display the message and exit.
More information about the texworks