PageRenderTime 62ms CodeModel.GetById 31ms RepoModel.GetById 1ms app.codeStats 0ms

/build/distribution/IzPack/src/lib/com/izforge/izpack/util/TargetFactory.java

https://bitbucket.org/jorgenio/gvsig
Java | 733 lines | 299 code | 44 blank | 390 comment | 42 complexity | e292eb70aa19d918990e69023ee277bd MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception
  1. /*
  2. * $Id: TargetFactory.java 5819 2006-06-14 07:29:09Z cesar $
  3. * IzPack
  4. * Copyright (C) 2002 by Elmar Grom
  5. *
  6. * File : TargetFactory.java
  7. * Description : provides factory methods and related functionality for OS specific isntantiations
  8. * Author's email : elmar@grom.net
  9. * Website : http://www.izforge.com
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  24. */
  25. package com.izforge.izpack.util;
  26. import java.io.BufferedReader;
  27. import java.io.File;
  28. import java.io.InputStream;
  29. import java.io.InputStreamReader;
  30. import java.util.StringTokenizer;
  31. /*---------------------------------------------------------------------------*/
  32. /**
  33. * The <code>TargetFactory</code> serves as a central mechanism to instantiate
  34. * OS specific class flavors, provide OS specific file extension types,
  35. * default install directories and similar functionality. In addition it
  36. * provides services that are related to OS versions and flavors. For a
  37. * tutorial on using some of the features in this class see the
  38. * <A HREF=doc-files/TargetFactory.html>TargetFactory Tutorial</A>.
  39. *
  40. * @version 0.0.1 / 1/3/2002
  41. * @author Elmar Grom
  42. */
  43. /*---------------------------------------------------------------------------*/
  44. /*$
  45. * @design
  46. *
  47. * Reports actually observed on some systems:
  48. *
  49. * OS OS Name Version Architecture Native Report (ver)
  50. * ----------------------------------------------------------------------------------------------------------
  51. * Windows 95
  52. * Windows 98 Windows 98 4.10 x86 Windows 98 [Version 4.10.1998]
  53. * Windows-ME Windows Me 4.90 x86 Windows Millennium [Version 4.90.3000]
  54. * Windows-NT 3.5
  55. * Windows-NT 4.0 Windows NT 4.0 x86 Windows NT Version 4.0
  56. * Windows 2000 Windows 2000 5.0 x86 Microsoft Windows 2000 [Version 5.00.2195]
  57. * Windows-XP Windows 2000 5.1 x86 Microsoft Windows XP [Version 5.1.2600]
  58. * Windows-XP Windows XP 5.1 x86
  59. * Mac
  60. * Mac OS-X
  61. * Linux Linux 2.4.7-10 i386
  62. * Linux Linux 2.4.18-4GB i386
  63. * Solaris
  64. *
  65. *---------------------------------------------------------------------------*/
  66. public class TargetFactory
  67. {
  68. // ------------------------------------------------------------------------
  69. // Constant Definitions
  70. // ------------------------------------------------------------------------
  71. // Basic operating systems
  72. /** Identifies Microsoft Windows. */
  73. public static final int WINDOWS = 0;
  74. /** Identifies generic UNIX operating systems */
  75. public static final int UNIX = 2;
  76. /** Used to report a non specific operating system. */
  77. public static final int GENERIC = 3;
  78. // operating system favors
  79. /** This is the basic flavor for every operating system. */
  80. public static final int STANDARD = 0;
  81. /** Used to identify the Windows-NT class of operating
  82. systems in terms of an OS flavor. It is reported for
  83. Windows-NT, 2000 and XP. */
  84. public static final int NT = 1;
  85. /** Used to identify the OS X flavor of the Mac OS */
  86. public static final int X = 2;
  87. // system architecture
  88. /** Identifies Intel X86 based processor types. */
  89. public static final int X86 = 0;
  90. /** Nonspecific processor architecture, other than X86. */
  91. public static final int OTHER = 1;
  92. /** The extensions used for native libraries on various operating
  93. systems. The string positions correspond to the basic operating
  94. system indexes. The following values are legal to use : <br><br>
  95. <ul>
  96. <li>WINDOWS
  97. <li>MAC
  98. <li>UNIX
  99. <li>GENERIC
  100. </ul> */
  101. static final String [] LIBRARY_EXTENSION =
  102. {
  103. "dll",
  104. "so",
  105. "",
  106. ""
  107. };
  108. /** The os specific class prefixes for classes that implement
  109. different versions for the various operating systems. The
  110. string positions correspond to the basic operating system
  111. indexes. The following values are legal to use : <br><br>
  112. <ul>
  113. <li>WINDOWS
  114. <li>MAC
  115. <li>UNIX
  116. <li>GENERIC
  117. </ul> */
  118. static final String [] CLASS_PREFIX =
  119. {
  120. "Win_",
  121. "Mac_",
  122. "Unix_",
  123. ""
  124. };
  125. /** The os favor specific class prefixes for classes the implement
  126. different versions for various os favors. The string positions
  127. correspond to the flavor indexes. The following values are
  128. legal to use : <br><br>
  129. <ul>
  130. <li>STANDARD
  131. <li>NT
  132. <li>X
  133. </ul> */
  134. static final String [] CLASS_FLAVOR_PREFIX =
  135. {
  136. "",
  137. "NT_",
  138. "X_"
  139. };
  140. /** The list of processor architecture specific prefixes. The string
  141. positions correspond to the architecture indexes. The following
  142. values are leegal to use : <br><br>
  143. <ul>
  144. <li>X86
  145. <li>OTHER
  146. </ul> */
  147. static final String [] CLASS_ARCHITECTURE_PREFIX =
  148. {
  149. "X86_", // Intel X86 architecture
  150. "U_" // unknown
  151. };
  152. /** The list of default install path fragments. Depending on
  153. the operating system, a path fragment might represent
  154. either a part of the default install path or the entire
  155. path to use. For MS-Windows it is always only a part
  156. of the full install path. The string positions correspond
  157. to the basic operating system indexes. The following
  158. values are leegal to use : <br><br>
  159. <ul>
  160. <li>WINDOWS
  161. <li>MAC
  162. <li>UNIX
  163. <li>GENERIC
  164. </ul> */
  165. static final String [] INSTALL_PATH_FRAGMENT =
  166. {
  167. "Program Files" + File.separator,
  168. "/Applications" + File.separator,
  169. "/usr/local" + File.separator,
  170. File.separator + "apps" + File.separator
  171. };
  172. /** This is a list of keys to use when looking for resources
  173. that define the default install path to use. The list is
  174. organized as two dimensional array of <code>String</code>s.
  175. To access the array, denote the first dimension with the
  176. operating system index and the second dimension with the
  177. flavor index. For example to access the key for Windows-NT
  178. use <code>INSTALL_PATH_RESOURCE_KEY[WINDOWS][NT]</code>
  179. The array uses a sparse population, that is, not all array
  180. locations actually contain a key. Only locations for which
  181. a real operating system/flavor combination exists are
  182. populated. For example, there is no such thing as
  183. <code>INSTALL_PATH_RESOURCE_KEY[UNIX][X]</code> */
  184. static final String [][] INSTALL_PATH_RESOURCE_KEY =
  185. {
  186. // Standard NT X
  187. { "TargetPanel.dir.windows", "TargetPanel.dir.windows", "" }, // Windows
  188. { "TargetPanel.dir.mac", "", "TargetPanel.dir.macosx" }, // Mac
  189. { "TargetPanel.dir.unix", "", "" }, // UNIX
  190. { "TargetPanel.dir", "", "" } // Generic
  191. };
  192. /** The delimiter characters used to tokenize version numbers */
  193. private static final String VERSION_DELIMITER = ".-";
  194. // ------------------------------------------------------------------------
  195. // Variable Declarations
  196. // ------------------------------------------------------------------------
  197. /** The reference to the single instance of <code>TargetFactory</code>. Used
  198. in static methods in place of <code>this</code>. */
  199. private static TargetFactory me = null;
  200. /** identifies the operating system we are running on */
  201. private int os = -1;
  202. /** identifies the operating system favor */
  203. private int osFlavor = -1;
  204. /** identifies the hardware architecture we are running on */
  205. private int architecture = -1;
  206. /** represents the version number of the target system */
  207. private String version = "";
  208. /*--------------------------------------------------------------------------*/
  209. /**
  210. * Constructor
  211. */
  212. /*--------------------------------------------------------------------------*/
  213. /*$
  214. * @design
  215. *
  216. * Identify the following about the target system:
  217. *
  218. * - OS type
  219. * - architecture
  220. * - version
  221. *
  222. * and store this information for later use.
  223. *--------------------------------------------------------------------------*/
  224. private TargetFactory ()
  225. {
  226. version = System.getProperty ("os.version");
  227. // ----------------------------------------------------
  228. // test for Windows
  229. // ----------------------------------------------------
  230. if (OsVersion.IS_WINDOWS)
  231. {
  232. os = WINDOWS;
  233. osFlavor = STANDARD;
  234. architecture = X86;
  235. String osName = OsVersion.OS_NAME.toLowerCase();
  236. if (osName.indexOf ("nt") > -1)
  237. {
  238. osFlavor = NT;
  239. }
  240. else if (osName.indexOf ("2000") > -1)
  241. {
  242. osFlavor = NT;
  243. }
  244. else if (osName.indexOf ("xp") > -1)
  245. {
  246. osFlavor = NT;
  247. }
  248. }
  249. // ----------------------------------------------------
  250. // test for Mac OS
  251. // ----------------------------------------------------
  252. else if (OsVersion.IS_OSX)
  253. {
  254. os = X;
  255. osFlavor = STANDARD;
  256. architecture = OTHER;
  257. }
  258. // ----------------------------------------------------
  259. // what's left should be unix
  260. // ----------------------------------------------------
  261. else
  262. {
  263. os = UNIX;
  264. osFlavor = STANDARD;
  265. architecture = OTHER;
  266. String osName = OsVersion.OS_NAME.toLowerCase();
  267. if (osName.indexOf ("x86") > -1)
  268. {
  269. architecture = X86;
  270. }
  271. }
  272. }
  273. /*--------------------------------------------------------------------------*/
  274. /**
  275. * Returns an instance of <code>TargetFactory</code> to use.
  276. *
  277. * @return an instance of <code>TargetFactory</code>.
  278. */
  279. /*--------------------------------------------------------------------------*/
  280. public static TargetFactory getInstance ()
  281. {
  282. if (me == null)
  283. {
  284. me = new TargetFactory ();
  285. }
  286. return me;
  287. }
  288. /*--------------------------------------------------------------------------*/
  289. /**
  290. * This method returns an OS and OS flavor specific instance of the requested
  291. * class.
  292. * <br><br>
  293. * <b>Class Naming Rules</b><br>
  294. * Class versions must be named with the OS and OS flavor as prefix. The
  295. * prefixes are simply concatenated, with the OS prefix first and the flavor
  296. * prefix second. Use the following OS specific prefixes:<br><br>
  297. * <TABLE BORDER=1>
  298. * <TR><TH>Operating System</TH><TH>Prefix</TH></TR>
  299. * <TR><TD>Microsoft Windows</TD><TD>Win_</TD></TR>
  300. * <TR><TD>Mac OS</TD><TD>Mac_</TD></TR>
  301. * <TR><TD>UNIX</TD><TD>UNIX_</TD></TR>
  302. * </TABLE><br>
  303. * For the different OS flavors, use these prefixes:<br><br>
  304. * <TABLE BORDER=1>
  305. * <TR><TH>OS Flavor</TH><TH>Prefix</TH></TR>
  306. * <TR><TD>NT</TD><TD>NT_</TD></TR>
  307. * <TR><TD>Mac OS X</TD><TD>X_</TD></TR>
  308. * </TABLE>
  309. * <br><br>
  310. * <b>Naming Example:</b>
  311. * <br><br>
  312. * For the class <code>MyClass</code>, the specific version for Windows NT
  313. * must be in the same package as <code>MyClass</code> and the name must be
  314. * <code>Win_NT_MyClass</code>. A version that should be instantiated for any
  315. * non-NT flavor would be called <code>Win_MyClass</code>. This would also
  316. * be the version instantiated on Windows NT if the version
  317. * <code>Win_NT_MyClass</code> does not exist.
  318. * <br><br>
  319. * <b>The Loading Process</b>
  320. * <br><br>
  321. * The process is completed after the first successful attempt to load
  322. * a class. <br>
  323. * <ol>
  324. * <li>load a version that is OS and OS-Flavor specific
  325. * <li>load a version that is OS specific
  326. * <li>load the base version (without OS or OS-Flavor prefix)
  327. * </ol><br>
  328. * See the <A HREF=doc-files/TargetFactory.html>TargetFactory Tutorial</A>
  329. * for more information.<br><br>
  330. *
  331. * @param name the fully qualified name of the class to load without
  332. * the extension.
  333. *
  334. * @return An instance of the requested class. Note that specific
  335. * initialization that can not be accomplished in the default
  336. * constructor still needs to be performed before the object
  337. * can be used.
  338. *
  339. * @exception Exception if all attempts to instantiate class fail
  340. */
  341. /*--------------------------------------------------------------------------*/
  342. public Object makeObject (String name) throws Exception
  343. {
  344. int nameStart = name.lastIndexOf ('.') + 1;
  345. String packageName = name.substring (0, nameStart);
  346. String className = name.substring (nameStart, name.length ());
  347. String actualName;
  348. try
  349. {
  350. actualName = packageName + CLASS_PREFIX [os] + CLASS_FLAVOR_PREFIX [osFlavor] + className;
  351. Class temp = Class.forName (actualName);
  352. return temp.newInstance();
  353. }
  354. catch (Throwable exception1)
  355. {
  356. try
  357. {
  358. Class temp = Class.forName (packageName + CLASS_PREFIX [os] + className);
  359. return temp.newInstance();
  360. }
  361. catch (Throwable exception2)
  362. {
  363. try
  364. {
  365. actualName = name;
  366. Class temp = Class.forName (actualName);
  367. return temp.newInstance();
  368. }
  369. catch (Throwable exception3)
  370. {
  371. throw new Exception("can not instantiate class " + name);
  372. }
  373. }
  374. }
  375. }
  376. /*--------------------------------------------------------------------------*/
  377. /**
  378. * Returns true if the version in the parameter string is higher than the
  379. * version of the target os.
  380. *
  381. * @param version the version number to compare to
  382. *
  383. * @return <code>false</code> if the version of the target system is
  384. * higher, otherwise <code>true</code>
  385. */
  386. /*--------------------------------------------------------------------------*/
  387. /*$
  388. * @design
  389. *
  390. * Version numbers are assumed to be constructed as follows:
  391. *
  392. * - a list of one or more numbers, separated by periods as in X.X.X. ...
  393. * or periods and dashes as in X.X.X-Y. ...
  394. * - the numbers follow the decimal number system
  395. * - the left most number is of highest significance
  396. *
  397. * The process compares each set of numbers, beginning at the most
  398. * significant and working down the ranks (this is working left to right).
  399. * The process is stopped as soon as the pair of numbers compaired is not
  400. * equal. If the numer for the target system is higher, flase is returned,
  401. * otherwise true.
  402. *--------------------------------------------------------------------------*/
  403. public boolean versionIsHigher (String version) throws Exception
  404. {
  405. StringTokenizer targetVersion = new StringTokenizer (this.version, VERSION_DELIMITER);
  406. StringTokenizer compareVersion = new StringTokenizer (version, VERSION_DELIMITER);
  407. int target;
  408. int compare;
  409. while (targetVersion.hasMoreTokens () && compareVersion.hasMoreTokens ())
  410. {
  411. try
  412. {
  413. target = Integer.parseInt (targetVersion.nextToken ());
  414. compare = Integer.parseInt (compareVersion.nextToken ());
  415. }
  416. catch (Throwable exception)
  417. {
  418. throw new Exception("error in version string");
  419. }
  420. if (compare > target)
  421. {
  422. return true;
  423. }
  424. else if (target > compare)
  425. {
  426. return false;
  427. }
  428. }
  429. return false;
  430. }
  431. /*--------------------------------------------------------------------------*/
  432. /**
  433. * Returns the index number for the target operating system that was detected.
  434. *
  435. * @return an index number for the OS
  436. *
  437. * @see #WINDOWS
  438. * @see #UNIX
  439. * @see #GENERIC
  440. */
  441. /*--------------------------------------------------------------------------*/
  442. public int getOS ()
  443. {
  444. return os;
  445. }
  446. /*--------------------------------------------------------------------------*/
  447. /**
  448. * Returns the index number for the operating system flavor that was
  449. * detected on the target system.
  450. *
  451. * @return an index for the OS flavor
  452. *
  453. * @see #STANDARD
  454. * @see #NT
  455. * @see #X
  456. */
  457. /*--------------------------------------------------------------------------*/
  458. public int getOSFlavor ()
  459. {
  460. return osFlavor;
  461. }
  462. /*--------------------------------------------------------------------------*/
  463. /**
  464. * Returns an index number that identified the processor architecture of
  465. * the target system.
  466. *
  467. * @return an index for the processor architecture
  468. *
  469. * @see #X86
  470. * @see #OTHER
  471. */
  472. /*--------------------------------------------------------------------------*/
  473. public int getArchitecture ()
  474. {
  475. return architecture;
  476. }
  477. /*--------------------------------------------------------------------------*/
  478. /**
  479. * Returns the file extension customarily used on the target OS for
  480. * dynamically loadable libraries.
  481. *
  482. * @return a <code>String</code> containing the customary library
  483. * extension for the target OS. Note that the string might
  484. * be empty if there no such specific extension for the target OS.
  485. */
  486. /*--------------------------------------------------------------------------*/
  487. public String getNativeLibraryExtension ()
  488. {
  489. return LIBRARY_EXTENSION[os];
  490. }
  491. /*--------------------------------------------------------------------------*/
  492. /**
  493. * Returns the system dependent default install path. This is typically
  494. * used to suggest an istall path to the end user, when performing an
  495. * installation. The default install path is assembled form the OS specific
  496. * path fragment specified in <code>INSTALL_PATH_FRAGMENT</code>, possibly
  497. * a drive letter and the application name. The user the option to define
  498. * resources that define default paths which differ from the path fragments
  499. * defined here. The following resource names will be recognized by this
  500. * method:
  501. * <br><br><ul>
  502. * <li><code>TargetPanel.dir.windows</code>
  503. * <li><code>TargetPanel.dir.macosx</code>
  504. * <li><code>TargetPanel.dir.unix</code>
  505. * <li><code>TargetPanel.dir</code> plus the all lower case version of
  506. * <code>System.getProperty ("os.name")</code>, with all spaces replaced
  507. * by an underscore ('_').
  508. * <li><code>TargetPanel.dir</code>
  509. * </ul>
  510. *
  511. * @param appName the name of the application to install. If no
  512. * specific resource has been set, then this name will
  513. * be appended to the OS specific default path fragment.
  514. *
  515. * @return the default install path for the target system
  516. */
  517. /*--------------------------------------------------------------------------*/
  518. /*$
  519. * @design
  520. *
  521. * First try to read a path string from a resource file. This approach allows
  522. * the user to customize the default install path that is suggested to the
  523. * end user by IzPack. There are a number of choices for the naming of this
  524. * resource, so we need to go through a few steps in order to exhaust the
  525. * different possibilities. If this was not successful we use the default
  526. * install path that is defined for the operating system we are running on.
  527. * This path should be expanded by the application name to form the full
  528. * path that to returne.
  529. *--------------------------------------------------------------------------*/
  530. public String getDefaultInstallPath (String appName)
  531. {
  532. String path = null;
  533. InputStream input;
  534. String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD];
  535. // ----------------------------------------------------
  536. // attempt to get an input stream through a resource
  537. // based on a key which is specific to the target OS
  538. // ----------------------------------------------------
  539. input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]);
  540. // ----------------------------------------------------
  541. // attempt to get an input stream through a resource
  542. // based on a key which is made specific to the target
  543. // OS by using the string returned by
  544. // System.getProperty ("os.name").toLowerCase ()
  545. // ----------------------------------------------------
  546. if (input == null)
  547. {
  548. String key = OsVersion.OS_NAME.toLowerCase().replace (' ', '_'); // avoid spaces in file names
  549. key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files
  550. input = TargetFactory.class.getResourceAsStream (key);
  551. }
  552. // ----------------------------------------------------
  553. // attempt to get an input stream through a resource
  554. // based on a key which is not specific to any target OS
  555. // ----------------------------------------------------
  556. if (input == null)
  557. {
  558. input = TargetFactory.class.getResourceAsStream (keyFragment);
  559. }
  560. // ----------------------------------------------------
  561. // If we got an input stream try to read the path
  562. // from the file
  563. // ----------------------------------------------------
  564. if (input != null)
  565. {
  566. InputStreamReader streamReader;
  567. BufferedReader reader = null;
  568. String line;
  569. try
  570. {
  571. streamReader = new InputStreamReader (input);
  572. reader = new BufferedReader (streamReader);
  573. line = reader.readLine ();
  574. while (line != null)
  575. {
  576. line = line.trim ();
  577. if (!line.equals (""))
  578. {
  579. break;
  580. }
  581. line = reader.readLine ();
  582. }
  583. path = line;
  584. }
  585. catch (Throwable exception)
  586. {
  587. }
  588. finally
  589. {
  590. try
  591. {
  592. if(reader != null)
  593. reader.close ();
  594. }
  595. catch (Throwable exception)
  596. {
  597. }
  598. }
  599. }
  600. // ----------------------------------------------------
  601. // if we were unable to obtain a path from a resource,
  602. // use the default for the traget operating system.
  603. // ----------------------------------------------------
  604. if (path == null || path.equals(""))
  605. {
  606. path = "";
  607. // --------------------------------------------------
  608. // if we run on windows, we need a valid drive letter
  609. // to put in front of the path. The drive that
  610. // contains the user's home directory is usually the
  611. // drive that also contains the install directory,
  612. // so this seems the best choice here.
  613. // --------------------------------------------------
  614. if (os == WINDOWS)
  615. {
  616. String home = System.getProperty ("user.home");
  617. // take everything up to and including the first '\'
  618. path = home.substring (0, home.indexOf(File.separatorChar) + 1);
  619. }
  620. path = path + INSTALL_PATH_FRAGMENT [os] + appName;
  621. }
  622. return path;
  623. }
  624. /**
  625. * Gets an Prefix Alias for the current Platform.
  626. * "Win_" on Windows Systems
  627. * "Win_NT_" on WinNT4, 2000, XP
  628. * Mac on Mac Mac_X on macosx and
  629. * Unix_
  630. * @return
  631. */
  632. public static String getCurrentOSPrefix()
  633. {
  634. String OSName = System.getProperty ("os.name").toLowerCase ();
  635. String OSArch = System.getProperty ("os.arch").toLowerCase ();
  636. int OS = 0;
  637. int OSFlavor = 0;
  638. int OSarchitecture = 0;
  639. // ----------------------------------------------------
  640. // test for Windows
  641. // ----------------------------------------------------
  642. if (OSName.indexOf ("windows") > -1)
  643. {
  644. OS = WINDOWS;
  645. OSFlavor = STANDARD;
  646. OSarchitecture = X86;
  647. if (OSName.indexOf ("nt") > -1)
  648. {
  649. OSFlavor = NT;
  650. }
  651. else if (OSName.indexOf ("2000") > -1)
  652. {
  653. OSFlavor = NT;
  654. }
  655. else if (OSName.indexOf ("xp") > -1)
  656. {
  657. OSFlavor = NT;
  658. }
  659. }
  660. // ----------------------------------------------------
  661. // test for Mac OS
  662. // ----------------------------------------------------
  663. else if (OSName.indexOf ("mac") > -1)
  664. {
  665. OS = GENERIC;
  666. OSFlavor = STANDARD;
  667. OSarchitecture = OTHER;
  668. if (OSName.indexOf ("macosx") > -1)
  669. {
  670. OSFlavor = X;
  671. }
  672. }
  673. // ----------------------------------------------------
  674. // what's left should be unix
  675. // ----------------------------------------------------
  676. else
  677. {
  678. OS = UNIX;
  679. OSFlavor = STANDARD;
  680. OSarchitecture = OTHER;
  681. if( OSArch.indexOf( "86" ) > -1 )
  682. {
  683. OSarchitecture = X86;
  684. }
  685. }
  686. return( CLASS_PREFIX [OS] + CLASS_FLAVOR_PREFIX [OSFlavor] );
  687. }
  688. }
  689. /*---------------------------------------------------------------------------*/