Browse Source

fix a problem in xamlil resource path generation, sometimes resource path look like avares://AssemblyName.dll/../../../ResourceName.xaml

pull/3151/head
Andrey Kunchev 7 years ago
parent
commit
22ae93ed95
  1. 10
      src/Avalonia.Build.Tasks/GenerateAvaloniaResourcesTask.cs

10
src/Avalonia.Build.Tasks/GenerateAvaloniaResourcesTask.cs

@ -33,15 +33,11 @@ namespace Avalonia.Build.Tasks
private byte[] _data;
private string _sourcePath;
public Source(string file, string root)
public Source(string relativePath, string root)
{
file = SPath.GetFullPath(file);
root = SPath.GetFullPath(root);
var fileUri = new Uri(file, UriKind.Absolute);
var rootUri = new Uri(root, UriKind.Absolute);
rootUri = new Uri(rootUri.ToString().TrimEnd('/') + '/');
Path = '/' + rootUri.MakeRelativeUri(fileUri).ToString().TrimStart('/');
_sourcePath = file;
Path = "/" + relativePath.Replace('\\', '/');
_sourcePath = SPath.Combine(root, relativePath);
Size = (int)new FileInfo(_sourcePath).Length;
}

Loading…
Cancel
Save