Here you can find the source of getRelativeLocalURI(String suffix)
Parameter | Description |
---|---|
suffix | a parameter |
public static URI getRelativeLocalURI(String suffix)
//package com.java2s; /* /*from w w w.ja va2 s. c om*/ * Copyright (C) 2008 Thomas Klapiscak (t.g.klapiscak@durham.ac.uk) * * This file is part of JASDL. * * JASDL is free software: you can redistribute it and/or modify * it under the terms of the Lesser GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JASDL 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 * Lesser GNU General Public License for more details. * * You should have received a copy of the Lesser GNU General Public License * along with JASDL. If not, see <http://www.gnu.org/licenses/>. * */ import java.io.File; import java.net.URI; public class Main { /** * Now works for both linux and windows * @param suffix * @return */ public static URI getRelativeLocalURI(String suffix) { return URI.create("file:///" + getCurrentDir().replace("\\", "/") + suffix); } public static String getCurrentDir() { File dir1 = new File("."); String strCurrentDir = ""; try { strCurrentDir = dir1.getCanonicalPath(); } catch (Exception e) { e.printStackTrace(); } return strCurrentDir; } }