https://github.com/frankhaugen/frank.symboliclinkhelper
A simple cross-platform symbolic link helper using DI
https://github.com/frankhaugen/frank.symboliclinkhelper
dependency-injection dotnet linux nuget symbolic-links windows
Last synced: 26 days ago
JSON representation
A simple cross-platform symbolic link helper using DI
- Host: GitHub
- URL: https://github.com/frankhaugen/frank.symboliclinkhelper
- Owner: frankhaugen
- License: mit
- Created: 2024-05-20T09:41:45.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-05-20T13:17:55.000Z (12 months ago)
- Last Synced: 2025-03-11T03:49:41.613Z (about 2 months ago)
- Topics: dependency-injection, dotnet, linux, nuget, symbolic-links, windows
- Language: C#
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Frank.SymbolicLinkHelper
[](LICENSE)
[](https://www.nuget.org/packages/Frank.SymbolicLinkHelper)
[](https://www.nuget.org/packages/Frank.SymbolicLinkHelper)This is a helper library for creating symbolic links in .NET. It is a wrapper around the Windows API function
`CreateSymbolicLink` or the Linux/Unix equivalent `symlink` function. It uses dependency injection to allow for swapping the
implementation of the helper implementation. This allows for platform specific implementations to be used in a
cross-platform and user-friendly way.This does not do any error handling, it is up to the caller to handle any exceptions that may be thrown such as
access/permission errors due to the file system protections or user permissions.## Installation
This library is available on NuGet. You can install it using the following command:
```bash
dotnet add package Frank.SymbolicLinkHelper
```## Usage
To use this library, you need to add the following code to your `Startup.cs` file:
```csharp
services.AddSymbolicLinkHelper();
```Then you can inject the `ISymbolicLinkHelper` interface into your classes and use it to create symbolic links:
```csharp
public class MyService
{
private readonly ISymbolicLinkHelper _symbolicLinkHelper;public MyService(ISymbolicLinkHelper symbolicLinkHelper)
{
_symbolicLinkHelper = symbolicLinkHelper;
}public void CreateSymbolicLink(string source, string target)
{
_symbolicLinkHelper.CreateSymbolicLink(new File/DirectoryInfo(source), new File/DirectoryInfo(target));
}
}
```## License
This library is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
## Contributing
Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
## Code of Conduct
Please read the [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file for more information.