mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-23 22:48:07 -05:00
Only download packages from the current project when opening in the Editor (#3619)
- Only download packages from the current project when opening in the editor - Make sure to download packages referenced within any libraries in the current project
This commit is contained in:
@@ -324,7 +324,7 @@ static class StartupLoadProject
|
|||||||
{
|
{
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
packagesToDownload.AddRange( CloudAsset.GetAssetReferences( false ) );
|
packagesToDownload.AddRange( CloudAsset.GetAssetReferences( true ) );
|
||||||
|
|
||||||
// 1. remove any installed packages we no longer need
|
// 1. remove any installed packages we no longer need
|
||||||
var required = new HashSet<string>();
|
var required = new HashSet<string>();
|
||||||
|
|||||||
@@ -280,7 +280,26 @@ public class CloudAsset
|
|||||||
string projectPath = Project.Current.GetAssetsPath().Replace( '\\', '/' );
|
string projectPath = Project.Current.GetAssetsPath().Replace( '\\', '/' );
|
||||||
var packages = new HashSet<string>( StringComparer.OrdinalIgnoreCase );
|
var packages = new HashSet<string>( StringComparer.OrdinalIgnoreCase );
|
||||||
|
|
||||||
var gr = AssetSystem.All.Where( x => x.AssetType.IsGameResource && (!currentProjectOnly || x.AbsolutePath.StartsWith( projectPath, StringComparison.OrdinalIgnoreCase )) );
|
HashSet<string> validAssetPaths = null;
|
||||||
|
if ( currentProjectOnly )
|
||||||
|
{
|
||||||
|
validAssetPaths = new HashSet<string>( StringComparer.OrdinalIgnoreCase );
|
||||||
|
|
||||||
|
// Include current project
|
||||||
|
validAssetPaths.Add( projectPath );
|
||||||
|
|
||||||
|
// Include all libraries used by the current project
|
||||||
|
foreach ( var library in LibrarySystem.All )
|
||||||
|
{
|
||||||
|
var libraryAssetsPath = library.Project.GetAssetsPath()?.Replace( '\\', '/' );
|
||||||
|
if ( !string.IsNullOrEmpty( libraryAssetsPath ) )
|
||||||
|
{
|
||||||
|
validAssetPaths.Add( libraryAssetsPath );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var gr = AssetSystem.All.Where( x => x.AssetType.IsGameResource && (!currentProjectOnly || validAssetPaths.Any( path => x.AbsolutePath.StartsWith( path, StringComparison.OrdinalIgnoreCase ) )) );
|
||||||
foreach ( var r in gr )
|
foreach ( var r in gr )
|
||||||
{
|
{
|
||||||
string json = null;
|
string json = null;
|
||||||
@@ -311,7 +330,7 @@ public class CloudAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var nativeResources = AssetSystem.All.Where( x => !x.AssetType.IsGameResource && (!currentProjectOnly || x.AbsolutePath.StartsWith( projectPath, StringComparison.OrdinalIgnoreCase )) ).ToArray();
|
var nativeResources = AssetSystem.All.Where( x => !x.AssetType.IsGameResource && (!currentProjectOnly || validAssetPaths.Any( path => x.AbsolutePath.StartsWith( path, StringComparison.OrdinalIgnoreCase ) )) ).ToArray();
|
||||||
foreach ( var r in nativeResources )
|
foreach ( var r in nativeResources )
|
||||||
{
|
{
|
||||||
var config = r?.Publishing?.ProjectConfig;
|
var config = r?.Publishing?.ProjectConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user