Skip to content

Commit

Permalink
Further code warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Nov 19, 2023
1 parent b529d39 commit 8729671
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/Akavache.Core/Platforms/apple-common/MacFilesystemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,8 @@ public class MacFilesystemProvider : IFilesystemProvider
private string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "BlobCache")
{
using var fm = new NSFileManager();
var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out _);
if (url == null)
{
throw new DirectoryNotFoundException();
}

var rp = url.RelativePath;
if (rp == null)
{
throw new DirectoryNotFoundException();
}

var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out _) ?? throw new DirectoryNotFoundException();
var rp = url.RelativePath ?? throw new DirectoryNotFoundException();
var ret = Path.Combine(rp, BlobCache.ApplicationName, subDir);
if (!Directory.Exists(ret))
{
Expand Down
4 changes: 4 additions & 0 deletions src/Akavache.Sqlite3/AsyncLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ public sealed class AsyncLock : IDisposable
/// </summary>
/// <param name="cancellationToken">A cancellation token which allows for release of the lock.</param>
/// <returns>A disposable which when Disposed will release the lock.</returns>
#if NETSTANDARD2_0 || XAMARINIOS || XAMARINMAC || XAMARINTVOS || MONOANDROID13_0
public Task<IDisposable?> LockAsync(CancellationToken cancellationToken = default)
#else
public Task<IDisposable?> LockAsync(in CancellationToken cancellationToken = default)

Check failure on line 33 in src/Akavache.Sqlite3/AsyncLock.cs

View workflow job for this annotation

GitHub Actions / build / build

Do not pass non-read-only struct by read-only reference. (https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1242)
#endif
{
var wait = _semaphore.WaitAsync(cancellationToken);

Expand Down

0 comments on commit 8729671

Please sign in to comment.