Gapotchenko.Shields.Canonical.Snap.Resolution
2025.3.2
Prefix Reserved
dotnet add package Gapotchenko.Shields.Canonical.Snap.Resolution --version 2025.3.2
NuGet\Install-Package Gapotchenko.Shields.Canonical.Snap.Resolution -Version 2025.3.2
<PackageReference Include="Gapotchenko.Shields.Canonical.Snap.Resolution" Version="2025.3.2" />
<PackageVersion Include="Gapotchenko.Shields.Canonical.Snap.Resolution" Version="2025.3.2" />
<PackageReference Include="Gapotchenko.Shields.Canonical.Snap.Resolution" />
paket add Gapotchenko.Shields.Canonical.Snap.Resolution --version 2025.3.2
#r "nuget: Gapotchenko.Shields.Canonical.Snap.Resolution, 2025.3.2"
#:package Gapotchenko.Shields.Canonical.Snap.Resolution@2025.3.2
#addin nuget:?package=Gapotchenko.Shields.Canonical.Snap.Resolution&version=2025.3.2
#tool nuget:?package=Gapotchenko.Shields.Canonical.Snap.Resolution&version=2025.3.2
Gapotchenko.Shields.Canonical.Snap.Resolution
The resolution module of the Gapotchenko Shield for Canonical Snap. This module provides package resolution services for Canonical Snap, allowing you to resolve file paths to their actual locations within Snap packages.
Overview
The resolution module enables you to resolve file paths that are managed by Canonical Snap packages.
When Snap packages install executables, they often create symbolic links in system directories (like /usr/bin) that point to the actual executables within the Snap package directories.
This module helps you find the real file paths inside Snap packages, even when accessed through these symbolic links.
Features
- Path Resolution: Resolves symbolic links to find actual file locations within Snap packages
- Snap Detection: Automatically detects if a file is managed by a Snap package
- Transparent Fallback: Returns the original path if the file is not managed by Snap
Usage
Resolving File Paths
The primary functionality is provided by the GetRealFilePath method:
using Gapotchenko.Shields.Canonical.Snap.Resolution;
// Resolve a file path that might be managed by Snap
string filePath = "/usr/bin/dotnet";
string realPath = SnapResolution.GetRealFilePath(filePath);
Console.WriteLine($"Original path: {filePath}");
Console.WriteLine($"Real path: {realPath}");
// If dotnet is installed via Snap, realPath might be something like:
// "/snap/dotnet-sdk/123/usr/share/dotnet/dotnet".
// Otherwise, GetRealFilePath function returns the original path.
Handling Non-Existent Files
The method handles non-existent files gracefully:
string nonExistentPath = "/usr/bin/nonexistent";
string resolved = SnapResolution.GetRealFilePath(nonExistentPath);
// Returns the original path if the file doesn't exist
How It Works
- Symbolic Link Resolution: The module follows symbolic links to find the final target
- Snap Detection: It checks if the resolved path points to the Snap executable (
snap) - Package Identification: It finds the associated Snap package
- Manifest Lookup: It reads the
snap.yamlpackage manifest file to find the actual file path within the package
Platform Support
- Linux: Full support. Resolves paths for Snap packages installed on Linux systems.
- macOS: Placeholder implementation (Snap can be installed on macOS but cannot be realistically used yet).
- Windows: Snap cannot be installed on Windows. The resolution operation returns the original path unchanged.
API Reference
SnapResolution
Main entry point for package resolution operations.
GetRealFilePath(string?)- Gets the real path of a file managed by Canonical Snap package manager. If the file is not managed by Snap, returns the original file path.
Installation
Gapotchenko.Shields.Canonical.Snap.Resolution module is available as a NuGet package:
dotnet package add Gapotchenko.Shields.Canonical.Snap.Resolution
Related Modules
- Deployment - Deployment discovery services (this module depends on it)
- Management - Package management operations (this module depends on it)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Gapotchenko.FX (>= 2025.1.45)
- Gapotchenko.FX.Collections (>= 2025.1.45)
- Gapotchenko.FX.Diagnostics.CommandLine (>= 2025.1.45)
- Gapotchenko.FX.IO (>= 2025.1.45)
- Gapotchenko.Shields.Canonical.Snap.Deployment (>= 2025.3.2)
- Gapotchenko.Shields.Canonical.Snap.Management (>= 2025.3.2)
- YamlDotNet (>= 16.3.0)
-
net10.0
- Gapotchenko.FX (>= 2025.1.45)
- Gapotchenko.FX.Collections (>= 2025.1.45)
- Gapotchenko.FX.Diagnostics.CommandLine (>= 2025.1.45)
- Gapotchenko.FX.IO (>= 2025.1.45)
- Gapotchenko.Shields.Canonical.Snap.Deployment (>= 2025.3.2)
- Gapotchenko.Shields.Canonical.Snap.Management (>= 2025.3.2)
- YamlDotNet (>= 16.3.0)
-
net8.0
- Gapotchenko.FX (>= 2025.1.45)
- Gapotchenko.FX.Collections (>= 2025.1.45)
- Gapotchenko.FX.Diagnostics.CommandLine (>= 2025.1.45)
- Gapotchenko.FX.IO (>= 2025.1.45)
- Gapotchenko.Shields.Canonical.Snap.Deployment (>= 2025.3.2)
- Gapotchenko.Shields.Canonical.Snap.Management (>= 2025.3.2)
- YamlDotNet (>= 16.3.0)
-
net9.0
- Gapotchenko.FX (>= 2025.1.45)
- Gapotchenko.FX.Collections (>= 2025.1.45)
- Gapotchenko.FX.Diagnostics.CommandLine (>= 2025.1.45)
- Gapotchenko.FX.IO (>= 2025.1.45)
- Gapotchenko.Shields.Canonical.Snap.Deployment (>= 2025.3.2)
- Gapotchenko.Shields.Canonical.Snap.Management (>= 2025.3.2)
- YamlDotNet (>= 16.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.