8000 Fix restore command absolute path error for Windows by MattKotsenas · Pull Request #190 · dn-vm/dnvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix restore command absolute path error for Windows #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 4, 2025

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
0