From 377d9de1ff1e2fabcd9bb7f65c0318f3c890392c Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sun, 9 Jun 2013 06:00:47 +0200
Subject: Fix Bug 683 part1b: Add IOUtil.getRelativeOf(URL, ..), wrapper for
 URI for convenience (JOGL ShaderCode) and bwd. compatibility

---
 src/java/com/jogamp/common/util/IOUtil.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'src/java/com/jogamp/common/util/IOUtil.java')

diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index d2b97a0..46d6b24 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -591,6 +591,18 @@ public class IOUtil {
         return compose(baseURI.getScheme(), baseURI.getRawSchemeSpecificPart(), relativePath, baseURI.getRawFragment());
     }
     
+    /**
+     * Wraps {@link #getRelativeOf(URI, String)} for convenience.
+     * @throws IOException
+     */
+    public static URL getRelativeOf(URL baseURL, String relativePath) throws IOException {    
+        try {
+            return getRelativeOf(baseURL.toURI(), relativePath).toURL();
+        } catch (URISyntaxException e) {
+            throw new IOException(e);
+        }
+    }
+    
     /**
      * Generates a URI for the <i>relativePath</i> relative to the <i>schemeSpecificPart</i>,
      * hence the result is a absolute location.
-- 
cgit v1.2.3