mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Fix for PR 38468: Error in files location.
Use the 'getCanonicalPath' method of the 'File' class to obtain the file name.
This commit is contained in:
parent
5deee229dd
commit
93129aabdc
4 changed files with 60 additions and 18 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2003-16-10 Mikhail Khodjaiants
|
||||||
|
Fix for PR 38468: Error in files location.
|
||||||
|
Use the 'getCanonicalPath' method of the 'File' class to obtain the file name.
|
||||||
|
* CDirectorySourceLocation.java
|
||||||
|
* CProjectSourceLocation.java
|
||||||
|
* CSourceLocator.java
|
||||||
|
|
||||||
2003-15-10 Mikhail Khodjaiants
|
2003-15-10 Mikhail Khodjaiants
|
||||||
Fix for PR 43101: Breakpoint exception when source doesn't exist.
|
Fix for PR 43101: Breakpoint exception when source doesn't exist.
|
||||||
The 'fireBreakpointChanged' method of 'BreakpointManager' is used to notify
|
The 'fireBreakpointChanged' method of 'BreakpointManager' is used to notify
|
||||||
|
|
|
@ -145,8 +145,20 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
return fAssociation;
|
return fAssociation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object findFileByAbsolutePath( String fileName )
|
private Object findFileByAbsolutePath( String name )
|
||||||
{
|
{
|
||||||
|
File file = new File( name );
|
||||||
|
if ( !file.isAbsolute() )
|
||||||
|
return null;
|
||||||
|
String fileName;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fileName = file.getCanonicalPath();
|
||||||
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
IPath filePath = new Path( fileName );
|
IPath filePath = new Path( fileName );
|
||||||
IPath path = getDirectory();
|
IPath path = getDirectory();
|
||||||
IPath association = getAssociation();
|
IPath association = getAssociation();
|
||||||
|
@ -169,7 +181,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = filePath.toFile();
|
file = filePath.toFile();
|
||||||
if ( file.exists() )
|
if ( file.exists() )
|
||||||
{
|
{
|
||||||
return createExternalFileStorage( filePath );
|
return createExternalFileStorage( filePath );
|
||||||
|
@ -186,6 +198,9 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
File file = path.toFile();
|
File file = path.toFile();
|
||||||
if ( file.exists() )
|
if ( file.exists() )
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
path = new Path( file.getCanonicalPath() );
|
||||||
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
|
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
|
||||||
if ( f != null )
|
if ( f != null )
|
||||||
{
|
{
|
||||||
|
@ -193,6 +208,10 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
}
|
}
|
||||||
return createExternalFileStorage( path );
|
return createExternalFileStorage( path );
|
||||||
}
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -153,8 +152,17 @@ public class CProjectSourceLocation implements IProjectSourceLocation
|
||||||
|
|
||||||
private Object findFileByAbsolutePath( String name )
|
private Object findFileByAbsolutePath( String name )
|
||||||
{
|
{
|
||||||
IPath path = new Path( name );
|
File file = new File( name );
|
||||||
return findFile( getProject(), path.toOSString() );
|
Object result = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( file.isAbsolute() )
|
||||||
|
result = findFile( getProject(), file.getCanonicalPath() );
|
||||||
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object findFileByRelativePath( IContainer container, String fileName )
|
private Object findFileByRelativePath( IContainer container, String fileName )
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -249,9 +250,12 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
|
||||||
|
|
||||||
private Object findFileByAbsolutePath( String fileName )
|
private Object findFileByAbsolutePath( String fileName )
|
||||||
{
|
{
|
||||||
Path path = new Path( fileName );
|
File file = new File( fileName );
|
||||||
if ( path.isAbsolute() && path.toFile().exists() )
|
if ( file.isAbsolute() && file.exists() )
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Path path = new Path( file.getCanonicalPath() );
|
||||||
// Try for a file in another workspace project
|
// Try for a file in another workspace project
|
||||||
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
|
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
|
||||||
if ( f != null && f.exists() )
|
if ( f != null && f.exists() )
|
||||||
|
@ -260,6 +264,10 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
|
||||||
}
|
}
|
||||||
return new FileStorage( path );
|
return new FileStorage( path );
|
||||||
}
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue