Skip to content

Commit

Permalink
fix: dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jolexxa committed Nov 30, 2024
1 parent 9d58e16 commit 3cbd88a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Chickensoft.GodotEnv.Tests.Features.Godot.Domain;
public class GodotRepositoryTest {
[Fact]
public async Task AddOrUpdateGodotEnvVariable() {
var WORKING_DIR = ".";
var workingDir = ".";
var godotVar = "GODOT";

var computer = new Mock<IComputer>();
Expand All @@ -29,7 +29,7 @@ public async Task AddOrUpdateGodotEnvVariable() {
? OSType.Windows
: OSType.Unknown);

fileClient.Setup(fc => fc.AppDataDirectory).Returns(WORKING_DIR);
fileClient.Setup(fc => fc.AppDataDirectory).Returns(workingDir);

// GodotBinPath
fileClient.Setup(fc => fc.Combine(fileClient.Object.AppDataDirectory, Defaults.GODOT_PATH, Defaults.GODOT_BIN_NAME))
Expand Down
14 changes: 7 additions & 7 deletions GodotEnv/Chickensoft.GodotEnv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ToolCommandName>godotenv</ToolCommandName>
<Nullable>enable</Nullable>
<CopyAllFiles>true</CopyAllFiles>
<NoWarn>NU1903</NoWarn>

<Title>GodotEnv</Title>
<Version>2.6.0</Version>
Expand Down Expand Up @@ -42,17 +43,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CliFx" Version="2.3.4" />
<PackageReference Include="Downloader" Version="3.0.6" />
<PackageReference Include="CliFx" Version="2.3.5" />
<PackageReference Include="Downloader" Version="3.3.1" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
<PackageReference Include="CliWrap" Version="3.4.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.IO.Abstractions" Version="21.1.3" />
<PackageReference Include="CliWrap" Version="3.6.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="CaseExtensions" Version="1.1.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
<PackageReference Include="UACHelper" Version="1.3.0.5" />
</ItemGroup>
</Project>
18 changes: 9 additions & 9 deletions GodotEnv/src/common/clients/FileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,19 +390,19 @@ public string Sanitize(string path) =>
public string Combine(params string[] paths) => Files.Path.Combine(paths);

public string DirectorySymlinkTarget(string symlinkPath)
=> Files.DirectoryInfo.FromDirectoryName(symlinkPath).LinkTarget;
=> Files.DirectoryInfo.New(symlinkPath).LinkTarget!;

public string FileSymlinkTarget(string symlinkPath)
=> Files.FileInfo.FromFileName(symlinkPath).LinkTarget;
=> Files.FileInfo.New(symlinkPath).LinkTarget!;

public void CreateDirectory(string path)
=> Files.Directory.CreateDirectory(path);

public string GetParentDirectoryPath(string path) =>
Files.Path.GetDirectoryName(path);
Files.Path.GetDirectoryName(path)!;

public string GetParentDirectoryName(string path) =>
Files.DirectoryInfo.FromDirectoryName(path).Name;
Files.DirectoryInfo.New(path).Name;

public async Task CreateSymlink(string path, string pathToTarget) {
// See what kind of symlink we're dealing with by checking the target.
Expand Down Expand Up @@ -450,10 +450,10 @@ public async Task CreateSymlinkRecursively(string path, string pathToTarget) {
}

public bool IsDirectorySymlink(string path)
=> Files.DirectoryInfo.FromDirectoryName(path).LinkTarget != null;
=> Files.DirectoryInfo.New(path).LinkTarget != null;

public bool IsFileSymlink(string path)
=> Files.FileInfo.FromFileName(path).LinkTarget != null;
=> Files.FileInfo.New(path).LinkTarget != null;

public async Task DeleteDirectory(string path) {
if (!DirectoryExists(path)) { return; }
Expand All @@ -471,7 +471,7 @@ await ProcessRunner.RunElevatedOnWindows(

if (OS == OSType.Windows) {
var parentDirectory = GetParentDirectoryPath(path);
var directoryInfo = Files.DirectoryInfo.FromDirectoryName(path);
var directoryInfo = Files.DirectoryInfo.New(path);

// Delete files inside directory using command prompt to prevent
// C# permissions issues.
Expand Down Expand Up @@ -536,7 +536,7 @@ public string GetRootedPath(string url, string basePath) {
public bool DirectoryExists(string path) => Files.Directory.Exists(path);

public IEnumerable<IDirectoryInfo> GetSubdirectories(string dir) =>
Files.DirectoryInfo.FromDirectoryName(dir).EnumerateDirectories();
Files.DirectoryInfo.New(dir).EnumerateDirectories();

public T ReadJsonFile<T>(string path) where T : notnull {
var contents = Files.File.ReadAllText(path);
Expand Down Expand Up @@ -599,7 +599,7 @@ public async Task<List<IFileInfo>> SearchRecursively(
Action<IDirectoryInfo, string> onDirectory,
string indent = ""
) {
var dirInfo = Files.DirectoryInfo.FromDirectoryName(dir);
var dirInfo = Files.DirectoryInfo.New(dir);
if (!dirInfo.Exists) {
throw new DirectoryNotFoundException(
$"Directory not found: {dirInfo.FullName}"
Expand Down
2 changes: 1 addition & 1 deletion GodotEnv/src/common/clients/ZipClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ILog log
continue;
}

Files.Directory.CreateDirectory(Files.Path.GetDirectoryName(fileName));
Files.Directory.CreateDirectory(Files.Path.GetDirectoryName(fileName)!);

using (var inputStream = entry.Open())
using (var outputStream = Files.File.OpenWrite(fileName)) {
Expand Down
2 changes: 1 addition & 1 deletion GodotEnv/src/common/clients/ZipClientTerminal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task ExtractToDirectory(
IProgress<double> progress,
ILog log
) {
var parentDir = Files.Path.GetDirectoryName(destinationDirectoryName);
var parentDir = Files.Path.GetDirectoryName(destinationDirectoryName)!;
Files.Directory.CreateDirectory(parentDir);
var shell = Computer.CreateShell(parentDir);

Expand Down
5 changes: 1 addition & 4 deletions GodotEnv/src/common/utilities/ProcessRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ namespace Chickensoft.GodotEnv.Common.Utilities;

using System;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using CliWrap;
Expand Down Expand Up @@ -102,8 +100,7 @@ public async Task<ProcessResult> RunElevatedOnWindows(
// doesn't have admin rights
bool shouldElevate = !UACHelper.UACHelper.IsElevated;

Process process = UACHelper.UACHelper.StartElevated(new ProcessStartInfo()
{
Process process = UACHelper.UACHelper.StartElevated(new ProcessStartInfo() {
FileName = exe,
Arguments = args,
UseShellExecute = shouldElevate,
Expand Down

0 comments on commit 3cbd88a

Please sign in to comment.