Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2895 #3055

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions TShockPluginManager/Nuget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

namespace TShockPluginManager
{

public class Nugetter
{
// this object can figure out the right framework folders to use from a set of packages
Expand Down Expand Up @@ -82,15 +81,13 @@
// make sure the source repository can actually tell us about dependencies
var dependencyInfoResource = await sourceRepository.GetResourceAsync<DependencyInfoResource>();
// get the try and dependencies
// (the above function returns a nullable value, but doesn't properly indicate it as such)
#pragma warning disable CS8602
var dependencyInfo = await dependencyInfoResource?.ResolvePackage(
if (dependencyInfoResource is null) continue;
var dependencyInfo = await dependencyInfoResource.ResolvePackage(
package, framework, cacheContext, logger, CancellationToken.None);
#pragma warning restore CS8602

// oop, we don't have the ability to get dependency info from this repository, or
// it wasn't found. let's try the next source repository!
if (dependencyInfo == null) continue;
if (dependencyInfo is null) continue;

availablePackages.Add(dependencyInfo);
foreach (var dependency in dependencyInfo.Dependencies)
Expand Down Expand Up @@ -231,11 +228,11 @@
}
else
{
pkgPath = null;

Check warning on line 231 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (osx-x64)

Converting null literal or possible null value to non-nullable type.

Check warning on line 231 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (linux-arm)

Converting null literal or possible null value to non-nullable type.

Check warning on line 231 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

Converting null literal or possible null value to non-nullable type.

Check warning on line 231 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (linux-x64)

Converting null literal or possible null value to non-nullable type.

Check warning on line 231 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (linux-arm64)

Converting null literal or possible null value to non-nullable type.
// die somehow
}
}
return (pkgPath, packageReader);

Check warning on line 235 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (osx-x64)

Nullability of reference types in value of type '(string? pkgPath, PackageReaderBase packageReader)' doesn't match target type '(string, PackageReaderBase)'.

Check warning on line 235 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (linux-arm)

Nullability of reference types in value of type '(string? pkgPath, PackageReaderBase packageReader)' doesn't match target type '(string, PackageReaderBase)'.

Check warning on line 235 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

Nullability of reference types in value of type '(string? pkgPath, PackageReaderBase packageReader)' doesn't match target type '(string, PackageReaderBase)'.

Check warning on line 235 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (linux-x64)

Nullability of reference types in value of type '(string? pkgPath, PackageReaderBase packageReader)' doesn't match target type '(string, PackageReaderBase)'.

Check warning on line 235 in TShockPluginManager/Nuget.cs

View workflow job for this annotation

GitHub Actions / build (linux-arm64)

Nullability of reference types in value of type '(string? pkgPath, PackageReaderBase packageReader)' doesn't match target type '(string, PackageReaderBase)'.
}

/// <returns>resolved packages to be installed for what the user requested</returns>
Expand Down Expand Up @@ -302,8 +299,11 @@

var relativeFolder = Path.GetDirectoryName(packageRelativeFilePath);
var targetFolder = Path.Join(isPlugin ? "./ServerPlugins" : "./bin", relativeFolder);
Directory.CreateDirectory(targetFolder);
File.Copy(filePath, Path.Join(targetFolder, Path.GetFileName(filePath)), true);
if (File.Exists(filePath))
{
Directory.CreateDirectory(targetFolder);
File.Copy(filePath, Path.Join(targetFolder, Path.GetFileName(filePath)), true);
}
}
}
}
Expand Down
Loading