예제 #1
0
        /// <summary> Looks for a Unix program.  Checks the PATH, and if not found there,
        /// checks the directory specified by the "application.home" Java property.
        /// ("application.home" was set by the "fdb" shell script.)
        ///
        /// </summary>
        /// <param name="program">program to find, e.g. "firefox"
        /// </param>
        /// <returns> path, or <code>null</code> if not found.
        /// </returns>
        private FileInfo findUnixProgram(String program)
        {
#if false
            String[] cmd = new String[] { "/bin/sh", "-c", "which " + program };          //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            try
            {
                System.Diagnostics.Process process = SupportClass.ExecSupport(cmd);

                StreamReader reader = process.StandardOutput;
                String       line   = reader.ReadLine();
                if (line != null)
                {
                    FileInfo f = new FileInfo(line);
                    bool     tmpBool;
                    if (File.Exists(f.FullName))
                    {
                        tmpBool = true;
                    }
                    else
                    {
                        tmpBool = Directory.Exists(f.FullName);
                    }
                    if (tmpBool)
                    {
                        return(f);
                    }
                }

                // Check in the Flex SDK's "bin" directory.  The "application.home"
                // property is set by the "fdb" shell script.
                String flexHome = SystemProperties.getProperty("application.home");                 //$NON-NLS-1$
                if (flexHome != null)
                {
                    FileInfo f = new FileInfo(flexHome + "\\" + "bin/" + program);                     //$NON-NLS-1$
                    bool     tmpBool2;
                    if (File.Exists(f.FullName))
                    {
                        tmpBool2 = true;
                    }
                    else
                    {
                        tmpBool2 = Directory.Exists(f.FullName);
                    }
                    if (tmpBool2)
                    {
                        return(f);
                    }
                }
            }
            catch (IOException)
            {
                // ignore
            }
#endif
            return(null);
        }