Start an external process on mac with c#

后端 未结 3 483
暖寄归人
暖寄归人 2021-02-06 01:15

I\'m successfully using System.Diagnostics.Process.Start() to start my external mono executable on windows. However it fails on mac. I\'m not getting any error, simply nothing a

3条回答
  •  遇见更好的自我
    2021-02-06 02:16

    To expand on Bryan answer, please do not hardcode the path /usr/bin/local/ in your code.

    To find out the correct path in each system, there are various techniques, but I'm not sure which is the best one:

    • Use which mono to locate the full path. For this you would need to call which from another Process instance. (Not sure if which comes by default in all Mac systems)
    • Use pkg-config to determine the prefix where Mono is installed. But beware, you cannot simply call system's pkg-config, you have to check first if mono's pkg-config exists. For that, you would need to check if this hardcoded path exists: /Library/Frameworks/Mono.framework/Versions/Current/bin/pkg-config (like it is done here).

提交回复
热议问题