From 1191a77b003e08bfe02a0ad9eba817fac3c92b5c Mon Sep 17 00:00:00 2001 From: axelcl Date: Sun, 2 Jan 2005 13:07:20 +0000 Subject: [PATCH 1/1] allow more default parser include paths --- .../phpdt/internal/ui/util/PHPFileUtil.java | 26 +++++++++++++------ 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java index dd1c59c..9341058 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java @@ -1,6 +1,6 @@ /* * Created on 09.08.2003 - * + * */ package net.sourceforge.phpdt.internal.ui.util; @@ -58,7 +58,7 @@ public class PHPFileUtil { } return false; } - + /** * Returns true iff the file extension is a valid PHP Unit name implementation is not creating extra strings. */ @@ -105,6 +105,7 @@ public class PHPFileUtil { /** * Determine the path of an include name string + * * @param includeNameString * @param resource * @param project @@ -112,7 +113,7 @@ public class PHPFileUtil { public static IPath determineFilePath(String includeNameString, IResource resource, IProject project) { IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(project); IPath resourcePath = resource.getProjectRelativePath(); - + File file = null; IPath path = null; path = documentRootPath.append(includeNameString); @@ -120,10 +121,8 @@ public class PHPFileUtil { if (file.exists()) { return path; } - - int index = includeNameString.indexOf('/'); - if (index < 0) { - // includeNameString contains no path separator + + if (includeNameString.startsWith("../")) { path = project.getLocation().append(resourcePath.removeLastSegments(1)); path = path.append(includeNameString); file = path.toFile(); @@ -131,7 +130,18 @@ public class PHPFileUtil { return path; } } - + + // int index = includeNameString.indexOf('/'); + // if (index < 0) { + // includeNameString contains no path separator + path = project.getLocation().append(resourcePath.removeLastSegments(1)); + path = path.append(includeNameString); + file = path.toFile(); + if (file.exists()) { + return path; + } + // } + List includePaths = ProjectPrefUtil.getIncludePaths(project); if (includePaths.size() > 0) { for (int i = 0; i < includePaths.size(); i++) { -- 1.7.1