8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.io;
27
28 import java.security.AccessController;
29 import sun.security.action.GetPropertyAction;
30
31
32 class UnixFileSystem extends FileSystem {
33
34 private final char slash;
35 private final char colon;
36 private final String javaHome;
37
38 public UnixFileSystem() {
39 slash = AccessController.doPrivileged(
40 new GetPropertyAction("file.separator")).charAt(0);
41 colon = AccessController.doPrivileged(
42 new GetPropertyAction("path.separator")).charAt(0);
43 javaHome = AccessController.doPrivileged(
44 new GetPropertyAction("java.home"));
45 }
46
47
48 /* -- Normalization and construction -- */
49
50 public char getSeparator() {
51 return slash;
52 }
53
54 public char getPathSeparator() {
55 return colon;
56 }
57
58 /* A normal Unix pathname contains no duplicate slashes and does not end
59 with a slash. It may be the empty string. */
60
61 /* Normalize the given pathname, whose length is len, starting at the given
62 offset; everything before this offset is already normal. */
63 private String normalize(String pathname, int len, int off) {
64 if (len == 0) return pathname;
|
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.io;
27
28 import java.util.Properties;
29 import sun.security.action.GetPropertyAction;
30
31
32 class UnixFileSystem extends FileSystem {
33
34 private final char slash;
35 private final char colon;
36 private final String javaHome;
37
38 public UnixFileSystem() {
39 Properties props = GetPropertyAction.getProperties();
40 slash = props.getProperty("file.separator").charAt(0);
41 colon = props.getProperty("path.separator").charAt(0);
42 javaHome = props.getProperty("java.home");
43 }
44
45
46 /* -- Normalization and construction -- */
47
48 public char getSeparator() {
49 return slash;
50 }
51
52 public char getPathSeparator() {
53 return colon;
54 }
55
56 /* A normal Unix pathname contains no duplicate slashes and does not end
57 with a slash. It may be the empty string. */
58
59 /* Normalize the given pathname, whose length is len, starting at the given
60 offset; everything before this offset is already normal. */
61 private String normalize(String pathname, int len, int off) {
62 if (len == 0) return pathname;
|