Skip to content
Permalink
Browse files

[Assets] Switch from implicit project to explicit project if necessary (

fixes #442)
  • Loading branch information
xen2 committed Aug 20, 2019
1 parent f61d50d commit 1813edc0e306670f14d8b07ae3381e832ad87144
Showing with 22 additions and 0 deletions.
  1. +17 −0 sources/assets/Xenko.Core.Assets/Package.cs
  2. +5 −0 sources/assets/Xenko.Core.Assets/PackageSession.cs
@@ -274,6 +274,23 @@ public bool IsDirty
[DataMemberIgnore]
public string RootNamespace { get; private set; }

[DataMemberIgnore]
public bool IsImplicitProject
{
get
{
// To keep in sync with LoadProject() .csproj
// Note: Meta is ignored since it is supposedly "read-only" from csproj
return (AssetFolders.Count == 1 && AssetFolders.First().Path == "Assets"
&& ResourceFolders.Count == 1 && ResourceFolders.First() == "Resources"
&& OutputGroupDirectories.Count == 0
&& ExplicitFolders.Count == 0
&& Bundles.Count == 0
&& RootAssets.Count == 0
&& TemplateFolders.Count == 0);
}
}

/// <summary>
/// Adds an existing project to this package.
/// </summary>
@@ -385,6 +385,11 @@ private void DirectDependencies_CollectionChanged(object sender, NotifyCollectio

protected override void SavePackage()
{
// Check if our project is still implicit one
// Note: we only allow transition from implicit to explicit (otherwise we would have to delete file, etc.)
if (IsImplicitProject && Package.IsDirty && !Package.IsImplicitProject)
IsImplicitProject = false;

if (!IsImplicitProject)
base.SavePackage();
}

0 comments on commit 1813edc

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