diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index a68ab6f..dc02efb 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' + dotnet-version: '9.0.x' - name: Run benchmark run: cd ForceOps.Benchmarks && dotnet run -c release --exporters json --filter '*' - name: Store benchmark result diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bca7cdf..4789539 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,7 +20,7 @@ jobs: - name: Install Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: "8.0.x" + dotnet-version: "9.0.x" - name: Dotnet Installation Info run: dotnet --info diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4fbfa52..1b55531 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,7 +33,7 @@ jobs: - name: Install Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: "8.0.x" + dotnet-version: "9.0.x" - name: Directory structure run: | @@ -61,7 +61,7 @@ jobs: with: draft: true name: "${{ steps.get_version.outputs.version }}" - files: ForceOps/bin_aot/Release/net8.0/win-x64/publish/ForceOps.exe + files: ForceOps/bin_aot/Release/net9.0/win-x64/publish/ForceOps.exe tag_name: "${{ steps.get_version.outputs.version }}" - name: Publish NuGet diff --git a/Directory.Build.props b/Directory.Build.props index 04e4627..105fd0f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ https://github.com/domsleee/forceops/blob/main/CHANGELOG.md false - net8.0 + net9.0 LatestMajor latest enable diff --git a/ForceOps.Benchmarks/ForceOps.Benchmarks.csproj b/ForceOps.Benchmarks/ForceOps.Benchmarks.csproj index 44c2d30..6e7e282 100644 --- a/ForceOps.Benchmarks/ForceOps.Benchmarks.csproj +++ b/ForceOps.Benchmarks/ForceOps.Benchmarks.csproj @@ -4,7 +4,7 @@ - + diff --git a/ForceOps.Benchmarks/src/FileAndDirectoryDeleterBenchmark.cs b/ForceOps.Benchmarks/src/FileAndDirectoryDeleterBenchmark.cs index 43eb6e1..32c8538 100644 --- a/ForceOps.Benchmarks/src/FileAndDirectoryDeleterBenchmark.cs +++ b/ForceOps.Benchmarks/src/FileAndDirectoryDeleterBenchmark.cs @@ -1,11 +1,10 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Jobs; using ForceOps.Lib; namespace ForceOps.Benchmarks; // [SimpleJob(RuntimeMoniker.NativeAot80)] -[SimpleJob(RuntimeMoniker.Net80)] +[SimpleJob] public class FileAndDirectoryDeleterBenchmark { readonly List fileDatas = new(); diff --git a/ForceOps.Lib/ForceOps.Lib.csproj b/ForceOps.Lib/ForceOps.Lib.csproj index 71868c8..9979817 100644 --- a/ForceOps.Lib/ForceOps.Lib.csproj +++ b/ForceOps.Lib/ForceOps.Lib.csproj @@ -15,7 +15,7 @@ - - + + \ No newline at end of file diff --git a/ForceOps.Test/ForceOps.Test.csproj b/ForceOps.Test/ForceOps.Test.csproj index 1702f11..be89e41 100644 --- a/ForceOps.Test/ForceOps.Test.csproj +++ b/ForceOps.Test/ForceOps.Test.csproj @@ -5,12 +5,11 @@ - + - - - - + + + runtime; build; native; contentfiles; analyzers all diff --git a/README.md b/README.md index fee2603..6adc78c 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,21 @@ Only supports windows, and not planned to support linux. Uses [LockChecker](https://github.com/domsleee/LockCheck) to find processes locking files, and will elevate itself if it the process is owned by another user. -See [Benchmarks](https://domsleee.github.io/ForceOps/) on github pages. +## Installation -Refer also to `10.4 Example: file deletion in Windows` from "A Philosophy of Software Design", which explains why this is a windows specific problem. Linux does not prevent the user from deleting a file if it is being used, see [unlink](https://man7.org/linux/man-pages/man2/unlink.2.html#:~:text=unlink()%20deletes%20a%20name,is%20made%20available%20for%20reuse.): +```shell +dotnet tool install -g forceops +``` -> If the name was the last link to a file but any processes still - have the file open, the file will remain in existence until the - last file descriptor referring to it is closed. +To update: +``` +dotnet tool update -g forceops +``` + +Alternatively, the executable is available for download in [the latest release]([releases](https://github.com/domsleee/ForceOps/releases/atest)). -## Examples + +## Usage: As a CLI ### Deleting when a process owned by the current user is using it ```shell ❯ forceops rm .\bin\ @@ -52,29 +58,6 @@ Refer also to `10.4 Example: file deletion in Windows` from "A Philosophy of Sof [15:07:42 INF] Successfully deleted as admin ``` - -## Supported operations - -Currently, only `delete` is supported. - -Operations like `move` and `copy` can have similar issues if they are overriding files or the source file is in use. It would be reasonable to support these operations in a similar way. - -For copying, consider using [Microsoft.Build.CopyOnWrite](https://github.com/microsoft/MSBuildSdks/tree/main/src/CopyOnWrite). - -## Usage: As a CLI - -To install the CLI, use the latest exe from [releases](https://github.com/domsleee/ForceOps/releases). - -Alternatively, it can be installed as a tool, using the [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0). -```bash -dotnet tool install -g forceops -``` - -To delete a file: -```bash -forceops delete file.txt -``` - ## Usage: As a library See the [ForceOps.Lib](https://www.nuget.org/packages/ForceOps.Lib) package. @@ -96,3 +79,19 @@ RelaunchHelpers.RunWithRelaunchAsElevated(() => } }, () => args.ToList(), forceOpsContext); ``` + +## Context + +See [Benchmarks](https://domsleee.github.io/ForceOps/) on github pages. + +Refer also to `10.4 Example: file deletion in Windows` from "A Philosophy of Software Design", which explains why this is a windows specific problem. Linux does not prevent the user from deleting a file if it is being used, see [unlink](https://man7.org/linux/man-pages/man2/unlink.2.html#:~:text=unlink()%20deletes%20a%20name,is%20made%20available%20for%20reuse.): + +> If the name was the last link to a file but any processes still + have the file open, the file will remain in existence until the + last file descriptor referring to it is closed. + +Currently, only `delete` is supported. + +Operations like `move` and `copy` can have similar issues if they are overriding files or the source file is in use. It would be reasonable to support these operations in a similar way. + +For copying, consider using [Microsoft.Build.CopyOnWrite](https://github.com/microsoft/MSBuildSdks/tree/main/src/CopyOnWrite). diff --git a/global.json b/global.json new file mode 100644 index 0000000..a02bac5 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "9.0.200", + "rollForward": "latestFeature" + } +}