Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EFS for Platform Committers"

 
Line 1: Line 1:
 
This page contains information about the Eclipse File System API ([[EFS]]) for developers working on code in the Eclipse platform.  While some of this information may be useful to others, it focuses on platform usage of EFS and may discuss internal platform details that are not applicable outside the platform.
 
This page contains information about the Eclipse File System API ([[EFS]]) for developers working on code in the Eclipse platform.  While some of this information may be useful to others, it focuses on platform usage of EFS and may discuss internal platform details that are not applicable outside the platform.
 +
 +
== Path versus Location ==
 +
There is a careful distinction in platform terminology between an IResource's ''path'' and ''location''.  The workspace itself can be viewed as a simple tree, with IWorkspaceRoot at the root, IProject at the first level, and IFolder/IFile nested to any depth within each project.  Resources also exist in some file system, and each file system can be represented as a tree.  However, the workspace tree and the file system tree '''are not necessarily the same'''.  For example, each IProject can be associated with a different file system, and each linked resource can be connected to a different file system. So, we need a way of finding resources within the workspace tree, and also a way to find resources in the file system.
 +
 +
The ''path'' of a resource is the position of the resource in the workspace tree.  A resource's path is obtained by calling IResource.getFullPath().  A resource path is always represented by an IPath object.
 +
 +
The ''location'' of a resource is the position of the resource in the file system.  A resource's location is obtained by calling IResource.getLocationURI().  Before the introduction of EFS, the resource location was also represented using IPath (IResource.getLocation()).  However, using IPath to represent a resource's location in the file system is '''obsolete''' since Eclipse 3.2.  The file system location of a resource must always be represented as a URI.  This is because IPath doesn't have powerful enough syntax to represent different kinds of file systems - it is purely for the local file system.
 +
 +
If you see code that uses IPath when dealing with a resource location on disk, it is wrong, and must be migrated to use URI.  The same is true for all "location" methods that use IPath: IResource.getLocation(), IProjectDescription.getLocation(), etc. These methods exist only for backwards compatibility.
  
  

Revision as of 10:22, 17 November 2006

This page contains information about the Eclipse File System API (EFS) for developers working on code in the Eclipse platform. While some of this information may be useful to others, it focuses on platform usage of EFS and may discuss internal platform details that are not applicable outside the platform.

Path versus Location

There is a careful distinction in platform terminology between an IResource's path and location. The workspace itself can be viewed as a simple tree, with IWorkspaceRoot at the root, IProject at the first level, and IFolder/IFile nested to any depth within each project. Resources also exist in some file system, and each file system can be represented as a tree. However, the workspace tree and the file system tree are not necessarily the same. For example, each IProject can be associated with a different file system, and each linked resource can be connected to a different file system. So, we need a way of finding resources within the workspace tree, and also a way to find resources in the file system.

The path of a resource is the position of the resource in the workspace tree. A resource's path is obtained by calling IResource.getFullPath(). A resource path is always represented by an IPath object.

The location of a resource is the position of the resource in the file system. A resource's location is obtained by calling IResource.getLocationURI(). Before the introduction of EFS, the resource location was also represented using IPath (IResource.getLocation()). However, using IPath to represent a resource's location in the file system is obsolete since Eclipse 3.2. The file system location of a resource must always be represented as a URI. This is because IPath doesn't have powerful enough syntax to represent different kinds of file systems - it is purely for the local file system.

If you see code that uses IPath when dealing with a resource location on disk, it is wrong, and must be migrated to use URI. The same is true for all "location" methods that use IPath: IResource.getLocation(), IProjectDescription.getLocation(), etc. These methods exist only for backwards compatibility.



Back to Eclipse File System API home

Back to the top