1

我正在开发 macOS Cataline 10.15.3。我正在开发一个 Unity 项目,并尝试合并 Google 的媒体管道。为此,我使用了 C# 的 Process 类,打开了一个进程并将其输出重定向到我的统一脚本。如果我有一个 C 代码,我可以编译它“gcc code.c”,然后我有使用“./a.out”运行的可执行文件,在 c# 中运行它的代码将是

      Process compiler = new Process() ;
      compiler.StartInfo.FileName = "PATH/a.out";
      compiler.StartInfo.Arguments = "./a.out ";
      compiler.StartInfo.UseShellExecute = false;
      compiler.StartInfo.RedirectStandardOutput = true;
      compiler.Start();
      UnityEngine.Debug.Log(compiler.StandardOutput.ReadToEnd());
      compiler.WaitForExit();

现在对于compiler.StartInfo.FileName,如果我转到代码文件,而不是转到可执行文件

compiler.StartInfo.FileName = "PATH/writer.cc";

我收到以下错误

ApplicationName='PATH/writer.cc', CommandLine='./a.out ', CurrentDirectory='', Native error= Access denied

拒绝访问

现在,mediapipe 使用 BAZEL。我通过使用终端导航到 mediapipe 目录来编译程序

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_out_cpu

我通过这个命令运行程序

bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_out_cpu --calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt

mediapipe 目录中的主文件是 BUILD 文件,但这不是可执行文件。我不知道可执行文件是什么或它在哪里。

所以这是我能做的最好的

compiler.StartInfo.FileName = "PATH/BUILD";
compiler.StartInfo.Arguments = "bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_out_cpu --calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt";

我得到相同的访问被拒绝错误

因此,要么我需要寻找 BAZEL 项目生成的可执行文件,要么我需要找到一种在没有可执行文件的情况下在 c# 中运行程序的方法。我也没有办法。

4

0 回答 0