mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 335298 - IncludePaths are canonicalised on creation. Only need to do this on Windows.
This commit is contained in:
parent
a7da2de702
commit
d20b5fe5b2
1 changed files with 16 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2010 QNX Software Systems and others.
|
* Copyright (c) 2004, 2011 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
* James Blackburn (Broadcom Corp.)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.utils;
|
package org.eclipse.cdt.utils;
|
||||||
|
|
||||||
|
@ -34,12 +35,13 @@ import org.eclipse.core.runtime.Platform;
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
public class PathUtil {
|
public class PathUtil {
|
||||||
|
/** Detect whether we're running on Windows (as IPath does) */
|
||||||
|
private static final boolean WINDOWS = java.io.File.separatorChar == '\\';
|
||||||
|
|
||||||
public static boolean isWindowsFileSystem() {
|
public static boolean isWindowsFileSystem() {
|
||||||
String os = System.getProperty("os.name"); //$NON-NLS-1$
|
return WINDOWS;
|
||||||
return (os != null && os.startsWith("Win")); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWorkspaceRoot getWorkspaceRoot() {
|
public static IWorkspaceRoot getWorkspaceRoot() {
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
if (workspace != null) {
|
if (workspace != null) {
|
||||||
|
@ -47,9 +49,16 @@ public class PathUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Windows discover the {@link java.io.File#getCanonicalPath()} for
|
||||||
|
* a given absolute path.
|
||||||
|
* On other platforms, and for relative paths returns the passed in fullPath
|
||||||
|
* @param fullPath
|
||||||
|
* @return canonicalized IPath or passed in fullPath.
|
||||||
|
*/
|
||||||
public static IPath getCanonicalPath(IPath fullPath) {
|
public static IPath getCanonicalPath(IPath fullPath) {
|
||||||
if (!fullPath.isAbsolute())
|
if (!WINDOWS || !fullPath.isAbsolute())
|
||||||
return fullPath;
|
return fullPath;
|
||||||
|
|
||||||
File file = fullPath.toFile();
|
File file = fullPath.toFile();
|
||||||
|
|
Loading…
Add table
Reference in a new issue