Skip to content
Permalink
Browse files

[Assets] Improve package upgrade when there is no ProjectReference

  • Loading branch information
xen2 committed Dec 13, 2018
1 parent 703ee57 commit 0f827539dd1be57298fe85e5d8fd9eec308686c5
Showing with 17 additions and 17 deletions.
  1. +17 −17 sources/assets/Xenko.Core.Assets/Package.cs
@@ -1268,25 +1268,25 @@ protected override void UpgradeAsset(AssetMigrationContext context, PackageVersi
var projectLocation = (UFile)(string)profile.ProjectReferences[0].Location;
assetFile.FilePath = UPath.Combine(assetFile.OriginalFilePath.GetFullDirectory(), (UFile)(projectLocation.GetFullPathWithoutExtension() + PackageFileExtension));
asset.Meta.Name = projectLocation.GetFileNameWithoutExtension();
}

for (int i = 0; i < profile.AssetFolders.Count; ++i)
{
var assetPath = UPath.Combine(assetFile.OriginalFilePath.GetFullDirectory(), (UDirectory)(string)profile.AssetFolders[i].Path);
assetPath = assetPath.MakeRelative(assetFile.FilePath.GetFullDirectory());
profile.AssetFolders[i].Path = (string)assetPath;
}

for (int i = 0; i < profile.AssetFolders.Count; ++i)
{
var assetPath = UPath.Combine(assetFile.OriginalFilePath.GetFullDirectory(), (UDirectory)(string)profile.AssetFolders[i].Path);
assetPath = assetPath.MakeRelative(assetFile.FilePath.GetFullDirectory());
profile.AssetFolders[i].Path = (string)assetPath;
}

for (int i = 0; i < profile.ResourceFolders.Count; ++i)
{
var resourcePath = UPath.Combine(assetFile.OriginalFilePath.GetFullDirectory(), (UDirectory)(string)profile.ResourceFolders[i]);
resourcePath = resourcePath.MakeRelative(assetFile.FilePath.GetFullDirectory());
profile.ResourceFolders[i] = (string)resourcePath;
}

asset.AssetFolders = profile.AssetFolders;
asset.ResourceFolders = profile.ResourceFolders;
asset.OutputGroupDirectories = profile.OutputGroupDirectories;
for (int i = 0; i < profile.ResourceFolders.Count; ++i)
{
var resourcePath = UPath.Combine(assetFile.OriginalFilePath.GetFullDirectory(), (UDirectory)(string)profile.ResourceFolders[i]);
resourcePath = resourcePath.MakeRelative(assetFile.FilePath.GetFullDirectory());
profile.ResourceFolders[i] = (string)resourcePath;
}

asset.AssetFolders = profile.AssetFolders;
asset.ResourceFolders = profile.ResourceFolders;
asset.OutputGroupDirectories = profile.OutputGroupDirectories;
}

asset.Profiles = DynamicYamlEmpty.Default;

0 comments on commit 0f82753

Please sign in to comment.
You can’t perform that action at this time.