WakaTime.PythonManager.GetPythonPath C# (CSharp) Method

GetPythonPath() static private method

static private GetPythonPath ( ) : string
return string
        internal static string GetPythonPath()
        {
            if (PythonBinaryLocation != null)
                return PythonBinaryLocation;

            var path = TryGetPathFromMicrosoftRegister () ?? TryGetPathFromFixedPath ();

            return path;
        }

Usage Example

Example #1
0
        public static void HeartBeat(string apiKey, string file, bool write = false)
        {
            if (!PythonManager.IsPythonInstalled())
            {
                return;
            }

            string arguments = "--key " + apiKey +
                               " --file " + "\"" + file + "\"" +
                               " --plugin " + WakaTimeConstants.PLUGIN_NAME +
                               " --project " + Main.GetProjectName() +
                               " --verbose";

            if (Main.IsDebug)
            {
                UnityEngine.Debug.Log("Sending file: " + PythonManager.GetPythonPath() + " " + GetClientPath() +
                                      " " + arguments);
            }

            Process p = new Process {
                StartInfo =
                {
                    FileName               = PythonManager.GetPythonPath(),
                    Arguments              = "\"" + GetClientPath() + "\" " + arguments,
                    CreateNoWindow         = true,
                    WindowStyle            = ProcessWindowStyle.Hidden,
                    WorkingDirectory       = Application.dataPath,
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError  = true
                }
            };

            p.Start();

            if (Main.IsDebug)
            {
                var output = p.StandardOutput.ReadToEnd();
                if (output.Length > 0)
                {
                    UnityEngine.Debug.Log("Wakatime Output: " + output);
                }

                var errors = p.StandardError.ReadToEnd();
                if (errors.Length > 0)
                {
                    UnityEngine.Debug.LogError("Wakatime Error: " + errors);
                }
            }

            p.Close();
        }
All Usage Examples Of WakaTime.PythonManager::GetPythonPath