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 byte[] _data;
private string _sourcePath; private string _sourcePath;
public Source(string file, string root) public Source(string relativePath, string root)
{ {
file = SPath.GetFullPath(file);
root = SPath.GetFullPath(root); root = SPath.GetFullPath(root);
var fileUri = new Uri(file, UriKind.Absolute); Path = "/" + relativePath.Replace('\\', '/');
var rootUri = new Uri(root, UriKind.Absolute); _sourcePath = SPath.Combine(root, relativePath);
rootUri = new Uri(rootUri.ToString().TrimEnd('/') + '/');
Path = '/' + rootUri.MakeRelativeUri(fileUri).ToString().TrimStart('/');
_sourcePath = file;
Size = (int)new FileInfo(_sourcePath).Length; Size = (int)new FileInfo(_sourcePath).Length;
} }

Loading…
Cancel
Save