[msbuild] Fixed PathUtils.AbsoluteToRelative() logic (#1861)

* [msbuild] Fixed PathUtils.AbsoluteToRelative() logic

Don't require the 'absolute' path argument to be a FullPath.

The code already calls Path.GetFullPath() on the 'absolute'
path anyway.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=53176

* Fixed ResolveSymbolicLinks() to return the input path if realpath() fails
This commit is contained in:
Jeffrey Stedfast 2017-03-12 14:51:28 -04:00
Родитель 694bd212b3
Коммит 296cb5c3fa
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -33,7 +33,7 @@ namespace Xamarin.MacDev
try {
buffer = Marshal.AllocHGlobal (PATHMAX);
var result = realpath (path, buffer);
return result == IntPtr.Zero ? "" : Marshal.PtrToStringAuto (buffer);
return result == IntPtr.Zero ? path : Marshal.PtrToStringAuto (buffer);
} finally {
if (buffer != IntPtr.Zero)
Marshal.FreeHGlobal (buffer);
@ -42,7 +42,7 @@ namespace Xamarin.MacDev
public static string AbsoluteToRelative (string baseDirectory, string absolute)
{
if (!Path.IsPathRooted (absolute) || string.IsNullOrEmpty (baseDirectory))
if (string.IsNullOrEmpty (baseDirectory))
return absolute;
// canonicalize the paths