Skip to content

Please stop using FileIO registry internal variables #67

Description

@nhz2

This is a very fragile use of FileIO internals.

function __init__()
# Since FileIO PR #439 (July 2026) the central FileIO registry routes
# format"Excel" to XLSX.jl's own FileIO extension, and no longer covers
# legacy xls files at all. Loading ExcelFiles puts its loader first
# again, and registers a format for xls files. Users who don't load
# ExcelFiles are unaffected.
try
loaders = get!(Vector{FileIO.ActionSource}, FileIO.sym2loader, :Excel)
filter!(x -> x !== ExcelFiles, loaders)
pushfirst!(loaders, ExcelFiles)
savers = get!(Vector{FileIO.ActionSource}, FileIO.sym2saver, :Excel)
filter!(x -> x !== ExcelFiles, savers)
pushfirst!(savers, ExcelFiles)
if !haskey(FileIO.sym2info, :ExcelLegacy)
FileIO.add_format(FileIO.format"ExcelLegacy", (), [".xls"],
[:ExcelFiles => Base.UUID("89b67f3b-d1aa-5f6f-9ca4-282e8d98620d"), FileIO.LOAD])
end
catch err
@warn "ExcelFiles could not register itself with FileIO. Loading Excel files via FileIO.load may not use ExcelFiles." exception = (err, catch_backtrace())
end
return nothing
end

It will probably break in the future. Please make a PR to FileIO instead of doing this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions