langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourcePath.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
36 * It is implementation that is subject to change. |
36 * It is implementation that is subject to change. |
37 * Do not use it as an API |
37 * Do not use it as an API |
38 * |
38 * |
39 * @author Atul M Dambalkar |
39 * @author Atul M Dambalkar |
40 */ |
40 */ |
41 public |
41 public class SourcePath { |
42 class SourcePath { |
|
43 private final char dirSeparator = File.pathSeparatorChar; |
42 private final char dirSeparator = File.pathSeparatorChar; |
44 |
43 |
45 /** |
44 /** |
46 * The original class path string |
45 * The original class path string |
47 */ |
46 */ |
112 * Find the specified directory in the source path. |
111 * Find the specified directory in the source path. |
113 * |
112 * |
114 * @param name Name of the directory to be searched for in the source path. |
113 * @param name Name of the directory to be searched for in the source path. |
115 * @return File Return the directory if found else return null. |
114 * @return File Return the directory if found else return null. |
116 */ |
115 */ |
117 public File getDirectory(String name) { |
116 public File getDirectory(DocPath p) { |
118 for (int i = 0; i < sourcePath.length; i++) { |
117 for (int i = 0; i < sourcePath.length; i++) { |
119 File directoryNeeded = new File(sourcePath[i], name); |
118 File directoryNeeded = new File(sourcePath[i], p.getPath()); |
120 if (directoryNeeded.isDirectory()) { |
119 if (directoryNeeded.isDirectory()) { |
121 return directoryNeeded; |
120 return directoryNeeded; |
122 } |
121 } |
123 } |
122 } |
124 return null; |
123 return null; |