Skip to content
Permalink
Browse files

[Assets] Fix asset upgrade

  • Loading branch information
xen2 committed Dec 13, 2018
1 parent fb7296b commit bea53b99a317851fca271153514b22225d4cdad9
Showing with 25 additions and 22 deletions.
  1. +25 −22 sources/assets/Xenko.Core.Assets/Package.cs
@@ -1264,30 +1264,33 @@ protected override void UpgradeAsset(AssetMigrationContext context, PackageVersi

foreach (var profile in profiles)
{
if (profile.Platform == "Shared" && profile.ProjectReferences.Count == 1)
if (profile.Platform == "Shared")
{
var projectLocation = (UFile)(string)profile.ProjectReferences[0].Location;
assetFile.FilePath = UPath.Combine(assetFile.OriginalFilePath.GetFullDirectory(), (UFile)(projectLocation.GetFullPathWithoutExtension() + PackageFileExtension));
asset.Meta.Name = projectLocation.GetFileNameWithoutExtension();
if (profile.ProjectReferences.Count == 1)
{
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.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.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;
}

asset.Profiles = DynamicYamlEmpty.Default;

0 comments on commit bea53b9

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