Editor/sandmod.libraryplus/Extensions.cs
using System.IO;
using Sandbox;

namespace LibraryPlus;

public static class Extensions
{
	public static string ReferenceIdent( this Package self )
	{
		return Package.FormatIdent( self.Org.Ident, self.Ident );
	}

	internal static bool IsLibraryPlus( this Package self )
	{
		return ReferenceIdent( self ) == "sandmod.libraryplus";
	}

	internal static bool IsLibraryPlus( this Library self )
	{
		return self.Package.IsLibraryPlus();
	}

	internal static void MoveIfNeeded( this DirectoryInfo self, string destination )
	{
		if ( self.Exists )
		{
			Directory.CreateDirectory( Path.Combine( destination, ".." ) );
			self.MoveTo( destination );
		}
	}

	internal static void DeleteIfNeeded( this DirectoryInfo self, bool recursive = false )
	{
		if ( self.Exists )
		{
			self.Delete( recursive );
		}
	}
}