Skip to content

How to determine if command is available #438

Answered by chrisant996
sebthom asked this question in Q&A
Discussion options

You must be logged in to vote

No, but it's easy to do it yourself.

Loop over ipairs(string.explode(os.getenv("path"), ";")) and use os.isfile(path.join(dir_from_path, name_to_find). If the input name_to_find doesn't include an extension, then you'll want to also loop over either a list of predefined extensions or ipairs(string.explode(os.getenv("pathext"), ";")) and try os.isfile(name_to_find .. each_ext_from_list).

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@sebthom
Comment options

@chrisant996
Comment options

@chrisant996
Comment options

@sebthom
Comment options

@chrisant996
Comment options

Answer selected by sebthom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Question about something
2 participants