summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-27 20:29:40 +0100
committerSven Gothel <[email protected]>2013-11-27 20:29:40 +0100
commitbd72d40781caf40c2148cdc7990218af44750c76 (patch)
treea28da83b45d1f8cc62565c0da9cc66ba28f9d201 /src/java/com/jogamp/common
parenta42d7974725769407de82430ed77ec4b16d8a60c (diff)
IOUtil: Add comments to slashify args @ caller; Use validated File @ IOUtil.toURISimple ; DEBUG: stdout -> stderr
Add comments to slashify(..) arguments for better documentation. +++ Use validated File @ IOUtil.toURISimple(..): slashify(file, true, isDirectory) to slashify(new File(path).getAbsolutePath(), true, isDirectory) i.e. same w/ above variant and determine absolute path via File instance. +++ DEBUG: stdout -> stderr
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 537c3e9..15fb5ab 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -313,7 +313,7 @@ public class IOUtil {
* @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
*/
public static URI toURISimple(File file) throws URISyntaxException {
- return new URI(FILE_SCHEME, null, encodeToURI(slashify(file.getAbsolutePath(), true, file.isDirectory())), null);
+ return new URI(FILE_SCHEME, null, encodeToURI(slashify(file.getAbsolutePath(), true /* startWithSlash */, file.isDirectory() /* endWithSlash */)), null);
}
/**
@@ -321,8 +321,8 @@ public class IOUtil {
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
* @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
*/
- public static URI toURISimple(String protocol, String file, boolean isDirectory) throws URISyntaxException {
- return new URI(protocol, null, encodeToURI(slashify(file, true, isDirectory)), null);
+ public static URI toURISimple(String protocol, String path, boolean isDirectory) throws URISyntaxException {
+ return new URI(protocol, null, encodeToURI(slashify(new File(path).getAbsolutePath(), true /* startWithSlash */, isDirectory /* endWithSlash */)), null);
}
/**
@@ -412,7 +412,7 @@ public class IOUtil {
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
public static String getBasename(String fname) throws URISyntaxException {
- fname = slashify(fname, false, false);
+ fname = slashify(fname, false /* startWithSlash */, false /* endWithSlash */);
int lios = fname.lastIndexOf('/'); // strip off dirname
if(lios>=0) {
fname = fname.substring(lios+1);
@@ -425,7 +425,7 @@ public class IOUtil {
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
public static String getDirname(String fname) throws URISyntaxException {
- fname = slashify(fname, false, false);
+ fname = slashify(fname, false /* startWithSlash */, false /* endWithSlash */);
int lios = fname.lastIndexOf('/'); // strip off dirname
if(lios>=0) {
fname = fname.substring(0, lios+1);
@@ -487,7 +487,7 @@ public class IOUtil {
uriS = uriS.substring(0, idx+1); // exclude jar name, include terminal '/' or ':'
if( DEBUG ) {
- System.out.println("getJarURIDirname res: "+uriS);
+ System.err.println("getJarURIDirname res: "+uriS);
}
return uriS;
}
@@ -726,7 +726,7 @@ public class IOUtil {
if (baseLocation != null) {
final File file = new File(baseLocation, relativeFile);
// Handle things on Windows
- return slashify(file.getPath(), false, false);
+ return slashify(file.getPath(), false /* startWithSlash */, false /* endWithSlash */);
}
return null;
}