GetExecutableExtension() публичный статический Метод

Get an executable extension.
public static GetExecutableExtension ( ) : string
Результат string
Пример #1
0
 /// <summary>
 /// Construct a path to a binary in the Java distribution.
 /// </summary>
 /// <param name="javaTool">Name of the tool within the Java binary directory.</param>
 /// <returns>Path to the tool if it exists, null otherwise.</returns>
 private static string JavaHomeBinaryPath(string javaTool)
 {
     if (!String.IsNullOrEmpty(JavaHome))
     {
         string toolPath = Path.Combine(
             JavaHome, Path.Combine("bin", javaTool + CommandLine.GetExecutableExtension()));
         if (File.Exists(toolPath))
         {
             return(toolPath);
         }
     }
     return(null);
 }
Пример #2
0
        /// <summary>
        /// Find a Java tool.
        /// </summary>
        /// <param name="toolName">Name of the tool to search for.</param>
        private string FindJavaTool(string javaTool)
        {
            string javaHome = UnityEditor.EditorPrefs.GetString("JdkPath");

            if (string.IsNullOrEmpty(javaHome))
            {
                javaHome = Environment.GetEnvironmentVariable("JAVA_HOME");
            }
            string toolPath;

            if (javaHome != null)
            {
                toolPath = Path.Combine(
                    javaHome, Path.Combine(
                        "bin", javaTool + CommandLine.GetExecutableExtension()));
                if (!File.Exists(toolPath))
                {
                    EditorUtility.DisplayDialog("Play Services Dependencies",
                                                "JAVA_HOME environment references a directory (" +
                                                javaHome + ") that does not contain " + javaTool +
                                                " which is required to process Play Services " +
                                                "dependencies.", "OK");
                    throw new Exception("JAVA_HOME references incomplete Java distribution.  " +
                                        javaTool + " not found.");
                }
            }
            else
            {
                toolPath = CommandLine.FindExecutable(javaTool);
                if (!File.Exists(toolPath))
                {
                    EditorUtility.DisplayDialog("Play Services Dependencies",
                                                "Unable to find " + javaTool + " in the system " +
                                                "path.  This tool is required to process Play " +
                                                "Services dependencies.  Either set JAVA_HOME " +
                                                "or add " + javaTool + " to the PATH variable " +
                                                "to resolve this error.", "OK");
                    throw new Exception(javaTool + " not found.");
                }
            }
            return(toolPath);
        }
Пример #3
0
        /// <summary>
        /// Find a tool in the Android SDK.
        /// </summary>
        /// <param name="svcSupport">PlayServicesSupport instance used to retrieve the SDK
        /// path. </param>
        /// <param name="toolName">Name of the tool to search for.</param>
        /// <returns>String with the path to the tool if found, null otherwise.</returns>
        internal static string FindAndroidSdkTool(PlayServicesSupport svcSupport, string toolName)
        {
            string toolPath = null;
            string sdkPath  = svcSupport.SDK;

            if (sdkPath == null || sdkPath == "")
            {
                Debug.LogWarning(PlayServicesSupport.AndroidSdkConfigurationError +
                                 "  Will fallback to searching for " + toolName +
                                 " in the system path.");
            }
            else
            {
                string[] extensions;
                if (UnityEngine.RuntimePlatform.WindowsEditor ==
                    UnityEngine.Application.platform)
                {
                    extensions = new string[] { CommandLine.GetExecutableExtension(),
                                                ".bat", ".cmd" };
                }
                else
                {
                    extensions = new string[] { CommandLine.GetExecutableExtension() };
                }
                foreach (var extension in extensions)
                {
                    toolPath = Path.Combine(sdkPath, Path.Combine("tools", toolName + extension));
                    if (File.Exists(toolPath))
                    {
                        break;
                    }
                }
            }
            if (toolPath == null || !File.Exists(toolPath))
            {
                toolPath = CommandLine.FindExecutable(toolName);
            }
            return(toolPath);
        }
        /// <summary>
        /// Find a tool in the Android SDK.
        /// </summary>
        /// <param name="svcSupport">PlayServicesSupport instance used to retrieve the SDK
        /// path. </param>
        /// <param name="toolName">Name of the tool to search for.</param>
        /// <returns>String with the path to the tool if found, null otherwise.</returns>
        internal static string FindAndroidSdkTool(PlayServicesSupport svcSupport, string toolName)
        {
            string toolPath = null;
            string sdkPath  = svcSupport.SDK;

            if (sdkPath == null || sdkPath == "")
            {
                Debug.LogWarning(PlayServicesSupport.AndroidSdkConfigurationError +
                                 "  Will fallback to searching for " + toolName +
                                 " in the system path.");
            }
            else
            {
                toolPath = Path.Combine(
                    sdkPath, Path.Combine(
                        "tools", toolName + CommandLine.GetExecutableExtension()));
            }
            if (toolPath == null || !File.Exists(toolPath))
            {
                toolPath = CommandLine.FindExecutable(toolName);
            }
            return(toolPath);
        }
Пример #5
0
        /// <summary>
        /// Find a tool in the Android SDK.
        /// </summary>
        /// <param name="toolName">Name of the tool to search for.</param>
        /// <param name="sdkPath">SDK path to search for the tool.  If this is null or empty, the
        // system path is searched instead.</param>
        /// <returns>String with the path to the tool if found, null otherwise.</returns>
        private static string FindAndroidSdkTool(string toolName, string sdkPath = null)
        {
            if (String.IsNullOrEmpty(sdkPath))
            {
                PlayServicesResolver.Log(String.Format(
                                             "{0}\n" +
                                             "Falling back to searching for the Android SDK tool {1} in the system path.",
                                             PlayServicesSupport.AndroidSdkConfigurationError, toolName));
            }
            else
            {
                var extensions = new List <string> {
                    CommandLine.GetExecutableExtension()
                };
                if (UnityEngine.RuntimePlatform.WindowsEditor ==
                    UnityEngine.Application.platform)
                {
                    extensions.AddRange(new [] { ".bat", ".cmd" });
                }
                foreach (var dir in new [] { "tools", Path.Combine("tools", "bin") })
                {
                    foreach (var extension in extensions)
                    {
                        var currentPath = Path.Combine(sdkPath,
                                                       Path.Combine(dir, toolName + extension));
                        if (File.Exists(currentPath))
                        {
                            return(currentPath);
                        }
                    }
                }
            }
            var toolPath = CommandLine.FindExecutable(toolName);

            return(toolPath != null && File.Exists(toolPath) ? toolPath : null);
        }