Here you can find the source of getCanonicalPath(IPath fullPath)
Parameter | Description |
---|---|
fullPath | a parameter |
public static IPath getCanonicalPath(IPath fullPath)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2014 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://ww w. j av a 2 s .c o m * QNX Software Systems - initial API and implementation * Markus Schorn (Wind River Systems) * Ed Swartz (Nokia) * Sergey Prigogin (Google) * James Blackburn (Broadcom Corp.) *******************************************************************************/ import java.io.File; import java.io.IOException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; public class Main { /** * Return the canonical path (or the passed in path, if one couldn't be found). * @param fullPath * @return canonicalized IPath or passed in fullPath. */ public static IPath getCanonicalPath(IPath fullPath) { if (!fullPath.isAbsolute()) return fullPath; File file = fullPath.toFile(); try { String canonPath = file.getCanonicalPath(); IPath canonicalPath = new Path(canonPath); if (fullPath.getDevice() == null) canonicalPath = canonicalPath.setDevice(null); return canonicalPath; } catch (IOException ex) { } return fullPath; } }