Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions e2e-win/symlink.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Describe 'windows runtime symlink' {

BeforeAll {
$cfg = ".\mise.local.toml"
$tool = "yq"

$content = @"
[tools]
$tool = "latest"
"@
$content | Out-File $cfg
Get-Content $cfg
}

AfterAll {
Remove-Item $cfg -ErrorAction Ignore
}

It 'version is correct, not latest' {
mise install yq@4.45.4

# correct output
# mise/2025.5.15/bin/mise ls yq
# Tool Version Source Requested
# yq 4.45.4 D:\Users\qianlongzt\.config\mise\config.toml latest

# wrong output
# mise/2025.5.16/bin/mise ls yq
# Tool Version Source Requested
# yq latest D:\Users\qianlongzt\.config\mise\config.toml latest
# yq 4.45.4

# https://github.com/jdx/mise/discussions/5254

$output = mise ls --json yq
$output | jq '.[] | select(.source ) | .version' | Should -Be '"4.45.4"'
Comment thread
qianlongzt marked this conversation as resolved.
$output | jq '.[] | select(.version == "latest" ) | .version' | Should -Be $null
}
}
11 changes: 6 additions & 5 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,14 @@ pub fn make_symlink_or_file(target: &Path, link: &Path) -> Result<()> {
}

pub fn resolve_symlink(link: &Path) -> Result<Option<PathBuf>> {
if !link.is_symlink() {
return Ok(None);
}
if cfg!(windows) {
// Windows symlink are write in file currently
// may be changed to symlink in the future
if link.is_symlink() {
Ok(Some(fs::read_link(link)?))
} else if link.is_file() {
Ok(Some(fs::read_to_string(link)?.into()))
} else {
Ok(Some(fs::read_link(link)?))
Ok(None)
}
}

Expand Down
Loading