IVsUIShellOpenDocument.SearchProjectsForRelativePath Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts a relative path for a document to an absolute path that can be passed to OpenDocumentViaProject(String, Guid, IServiceProvider, IVsUIHierarchy, UInt32, IVsWindowFrame).
public:
int SearchProjectsForRelativePath(System::UInt32 grfRPS, System::String ^ pszRelPath, cli::array <System::String ^> ^ pbstrAbsPath);
public:
int SearchProjectsForRelativePath(unsigned int grfRPS, Platform::String ^ pszRelPath, Platform::Array <Platform::String ^> ^ pbstrAbsPath);
int SearchProjectsForRelativePath(unsigned int grfRPS, std::wstring const & pszRelPath, std::Array <std::wstring const &> const & pbstrAbsPath);
public int SearchProjectsForRelativePath (uint grfRPS, string pszRelPath, string[] pbstrAbsPath);
abstract member SearchProjectsForRelativePath : uint32 * string * string[] -> int
Public Function SearchProjectsForRelativePath (grfRPS As UInteger, pszRelPath As String, pbstrAbsPath As String()) As Integer
Parameters
- grfRPS
- UInt32
[in] Flags specifying how the search path should be resolved. For more information, see __VSRELPATHSEARCHFLAGS.
- pszRelPath
- String
[in] Relative path to the document. This might simply be the file name.
- pbstrAbsPath
- String[]
[out, retval] Full path name of the document. This is the same as the pszMkDocument
string value.
Returns
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsUIShellOpenDocument::SearchProjectsForRelativePath(
[in] VSRELPATHSEARCHFLAGS grfRPS,
[in] LPCOLESTR pszRelPath,
[out, retval] BSTR *pbstrAbsPath
);
This method uses two strategies:
Enumerates project items in all projects and compares
pszRelPath
to thepszMkDocument
(or project path, if the RPS_MatchByProjectPath flag is specified) of the project item. The comparison is not case-sensitive. The value ofpszRelPath
can be a document name without a path or a document name with a partial path that matches a valid right-hand portion of thepszMkDocument
(or project path). The active project is given first priority. This step can be skipped by setting thegrfRPS
parameter to a value of RPS_SkipEnumProjectItems.Ask all globally registered IVsRelativePathResolver objects to resolve the path. This mechanism allows a project language service to resolve relative paths against non-project items (for example, if a project has the concept of an INCLUDE search path). Global IVsRelativePathResolver objects should register a service GUID (SID) as a sub-key under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\RelativePathResolvers key in the registry.
QueryService
is called for each registered service for the IVsRelativePathResolver interface. This step can be skipped by setting thegrfRPS
parameter equal to RPS_SkipGlobalResolvers.
If neither of the methods attempted results in a match, the function sets *pbstrAbsPath
to null
and returns S_FALSE.