Skip to content

Commit 8d78087

Browse files
authored
Fix restore command absolute path error for Windows (#190)
* Fix SelfInstallTest to also run on Windows * Fix namespaces in UnitTests * Fix physical path conversion for Windows
1 parent e8b17b8 commit 8d78087

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/dnvm/DnvmEnv.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ public static DnvmEnv CreatePhysical(
115115
Action<string, string> setUserEnvVar)
116116
{
117117
Directory.CreateDirectory(realPath);
118+
118119
return new DnvmEnv(
119120
userHome: GetFolderPath(SpecialFolder.UserProfile, SpecialFolderOption.DoNotVerify),
120121
new SubFileSystem(PhysicalFs, PhysicalFs.ConvertPathFromInternal(realPath)),
121122
PhysicalFs,
122-
new UPath(Environment.CurrentDirectory),
123+
PhysicalFs.ConvertPathFromInternal(Environment.CurrentDirectory),
123124
isPhysical: true,
124125
getUserEnvVar,
125126
setUserEnvVar);

test/IntegrationTests/SelfInstallTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.ComponentModel;
44
using System.Diagnostics;
55
using System.Reflection;
6+
using System.Runtime.InteropServices;
67
using System.Security.Cryptography;
78
using Xunit;
89
using Xunit.Abstractions;
@@ -330,7 +331,11 @@ public async Task RunUpdateSelfInstaller()
330331
Directory.CreateDirectory(sdkDir);
331332
var fakeDotnet = Path.Combine(sdkDir, Utilities.DotnetExeName);
332333
Assets.MakeEchoExe(fakeDotnet, "Hello from dotnet test");
333-
_ = await ProcUtil.RunWithOutput("chmod", $"+x {fakeDotnet}");
334+
335+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
336+
{
337+
_ = await ProcUtil.RunWithOutput("chmod", $"+x {fakeDotnet}");
338+
}
334339

335340
var startVer = Program.SemVer;
336341
var result = await ProcUtil.RunWithOutput(

test/UnitTests/ManifestTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11

2-
using System.Net.Security;
3-
using Serde.Json;
42
using Dnvm;
5-
using Dnvm.Test;
63
using Semver;
74
using Xunit;
8-
using System.Net.NetworkInformation;
5+
6+
namespace Dnvm.Test;
97

108
public sealed class ManifestTests
119
{

test/UnitTests/SelectTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11

2-
using System.Collections.Immutable;
3-
using System.Runtime.CompilerServices;
4-
using Dnvm.Test;
52
using Spectre.Console.Testing;
63
using Xunit;
74
using Xunit.Abstractions;
85

9-
namespace Dnvm;
6+
namespace Dnvm.Test;
107

118
public sealed class SelectTests
129
{

0 commit comments

Comments
 (0)