共用方式為


PackageUtilities.MakeRelativeIfRooted(String, Url) Method

Definition

Returns a relative path if the specified file path is absolute and if it's in the same folder as the URL or a child folder of the URL.

public:
 static System::String ^ MakeRelativeIfRooted(System::String ^ fileName, Microsoft::VisualStudio::Shell::Url ^ url);
 static std::wstring MakeRelativeIfRooted(std::wstring const & fileName, Microsoft::VisualStudio::Shell::Url const & url);
public static string MakeRelativeIfRooted (string fileName, Microsoft.VisualStudio.Shell.Url url);
static member MakeRelativeIfRooted : string * Microsoft.VisualStudio.Shell.Url -> string
Public Function MakeRelativeIfRooted (fileName As String, url As Url) As String

Parameters

fileName
String

filename (is rooted) to be transformed

url
Url

the location to make the filename relative to

Returns

the relative path to the url or returns filename if not rooted

Remarks

If fileName is already relative, or if it is absolute and does not overlap url, this method returns fileName. Otherwise, it returns the portion of the path that does not overlap url.

Applies to