/**
 * This package provides classes to handle video in Processing. The API is compatible with the built-in video library of Processing. 
 * GSVideo uses the multimedia toolkit GStreamer (http://www.gstreamer.net/)  through the gstreamer-java bindings by Wayne Meissener:
 * http://code.google.com/p/gstreamer-java/ 
 * @author Andres Colubri
 * @version 0.5.1
 *
 * Copyright (c) 2008 Andres Colubri
 *
 * This source is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This code is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * A copy of the GNU General Public License is available on the World
 * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also
 * obtain it by writing to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package codeanticode.gsvideo;

import java.net.URL;

import com.sun.jna.Platform;

class LibraryPath
{
	String get()
	{
	    URL url = this.getClass().getResource("LibraryPath.class");
	    if (url != null)
	    {
	    	// Convert URL to string, taking care of spaces represented by the "%20" string.
	        String path = url.toString().replace("%20", " ");
	        //System.out.println(path);
	        int n0 = path.indexOf('/');
	        int n1 = path.indexOf("library");
	        if ((-1 < n0) && (-1 < n1)) 
	        {	
	        	// In Windows, path string starts with C:/...
	        	// so the first / is removed 
	        	int d = Platform.isWindows() ? 1 : 0;  
	            return path.substring(n0 + d, n1 + 7);
	        }
	        else return "";
	    }
	    return "";
	}
}