ToolPrefix.java 994 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* ToolPrefix.java -- Container of the toolPrefix String.
  2. Copyright (C) 2007 Free Software Foundation
  3. This file is part of libgcj.
  4. This software is copyrighted work licensed under the terms of the
  5. Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
  6. details. */
  7. package gnu.gcj.tools.gc_analyze;
  8. import java.io.File;
  9. class ToolPrefix
  10. {
  11. /**
  12. * Private constructor. No creation allowed. This class has
  13. * Static methods only.
  14. */
  15. private ToolPrefix()
  16. {
  17. }
  18. static String toolPrefix = "";
  19. static String pathPrefix = "";
  20. static File fileForName(String filename)
  21. {
  22. File f = new File(pathPrefix + filename);
  23. if (!f.canRead())
  24. {
  25. // Try it without the prefix.
  26. f = new File(filename);
  27. if (!f.canRead())
  28. {
  29. // Try to find it in the current directory.
  30. f = new File(f.getName());
  31. if (!f.canRead())
  32. return null;
  33. }
  34. }
  35. return f;
  36. }
  37. }