Skip to content

Commit

Permalink
fixlink more
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Nov 22, 2024
1 parent 75a6324 commit 0b57ad6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/MadsIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1895,18 +1895,21 @@ function fixlinks(dir::AbstractString="."; test::Bool=true, verbose::Bool=false)
if islink(f)
verbose && println("Checking Link: $(f)")
link = readlink(f)
if length(link) < 256 && isascii(link) && isfile(link)
if length(link) > 255
printstyled("Link `$(f)` needs to be fixed: it is too long!\n"; color=:red)
println(link)
elseif isfile(link)
printstyled("Link of `$(f)` to `$(link)` is OK\n"; color=:green)
else
printstyled("Link `$(f)` needs to be fixed: `$(link)` does not exist!\n"; color=:red)
link_win = Sys.iswindows() ? replace(fn, "/"=>"\\") : link
if isfile(link_win)
if length(link) < 256 && isascii(link) && isfile(link_win)
if !test
printstyled("Fixing Link: `$(link_win)` to `$(fn)`\n"; color=:yellow)
printstyled("Fixing Link: `$(f)` to `$(link_win)`\n"; color=:yellow)
rm(f)
symlink(link_win, f)
else
printstyled("Link needs to be fixed: `$(link_win)` to `$(fn)`\n"; color=:yellow)
printstyled("Link needs to be fixed: `$(f)` to `$(fn)`\n"; color=:yellow)
end
end
end
Expand Down

0 comments on commit 0b57ad6

Please sign in to comment.