Skip to content

Fix restore command absolute path error for Windows#190

Merged
agocke merged 3 commits intodn-vm:mainfrom
MattKotsenas:bugfix/restore-path
Apr 4, 2025
Merged

Fix restore command absolute path error for Windows#190
agocke merged 3 commits intodn-vm:mainfrom
MattKotsenas:bugfix/restore-path

Conversation

@MattKotsenas
Copy link
Contributor

When I run dnvm restore on Windows I get the following error:

Unhandled exception. System.ArgumentException: Path `C:/Projects/dnvm/global.json` must be absolute (Parameter 'path')
   at Zio.UPathExtensions.AssertAbsolute(UPath, String) + 0x1a7
   at Zio.FileSystems.FileSystem.ValidatePath(UPath, String, Boolean) + 0x66
   at Zio.FileSystems.FileSystem.FileExists(UPath) + 0x2e
   at Dnvm.RestoreCommand.<Run>d__1.MoveNext() + 0xa9
--- End of stack trace from previous location ---
   at Dnvm.Program.<Dnvm>d__3.MoveNext() + 0x4a7
--- End of stack trace from previous location ---
   at Dnvm.Program.<Main>d__1.MoveNext() + 0x259
--- End of stack trace from previous location ---
   at Dnvm.Program.<Main>(String[] args) + 0x28

This is because on Windows, UPath(Environment.CurrentDirectory) returns a non-absolute Windows-style (i.e. C:/) path. Calling ConvertPathFromInternal should address these issues.

While getting tests up and running, I updated ManifestTests and SelectTests to use the same Dnvm.Tests namespace as the other tests. I also made the chmod call conditional on platform in RunUpdateSelfInstaller so it works cross-platform.

Copy link
Collaborator

@agocke agocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@agocke agocke merged commit 8d78087 into dn-vm:main Apr 4, 2025
3 checks passed
@MattKotsenas MattKotsenas deleted the bugfix/restore-path branch April 11, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants