@maucejo 's https://github.com/maucejo/UFFFiles.jl was recently merged into the FileIO registry.
For my work, I have a custom package that handles similar files.
To handle the load / save logic, so far, I used the following in my package.
function load(f::File{format"UNV"})
...
end
function save(f::File{format"UNV"}, data)
...
end
detect_unv(io) = endswith(io.name, ".unv>") || endswith(io.name, ".uff>")
function __init__()
add_format(format"UNV", detect_unv, [".unv", ".uff"], [MyPackage])
end
Since 1.18, which is the introduction of UFFFiles in the registry, my tests fail for save, but load works fine.
ERROR: ArgumentError: Package UFFFiles [20c5726e-8372-4c34-be2c-190a5a70d483] is required but does not seem to be installed
I could have expected that both success (as in previous FileIO versions) or fail, but I don't understand a partial fail.
Any ideas what could be the reason ?
I've attempted to make a MWE, but in a module, not totally a package, so the init-equivalent step may not be relevant as such.
using Pkg
Pkg.activate("TestFileIO")
Pkg.add(name="FileIO", version="1.17")
unvname = joinpath(tempdir(), "test.unv")
write(unvname, "test")
module TempFileIO
using FileIO
function load(f::File{FileIO.format"UNV"})
open(f, "r") do s
String(take!(s.io))
end
end
function save(f::File{FileIO.format"UNV"}, data)
open(f, "w") do s
write(s.io, data)
end
end
detect_unv(io) = endswith(io.name, ".unv>") || endswith(io.name, ".uff>")
add_loader(format"UNV", detect_unv, [".unv", ".uff"], [TempFileIO])
end
using .TempFileIO
using FileIO
load(unvname) # Works regardless of version
save(unvname, "test") # Fails in 1.18+ since UFF is registered
@maucejo 's https://github.com/maucejo/UFFFiles.jl was recently merged into the FileIO registry.
For my work, I have a custom package that handles similar files.
To handle the
load/savelogic, so far, I used the following in my package.Since 1.18, which is the introduction of
UFFFilesin the registry, my tests fail forsave, butloadworks fine.I could have expected that both success (as in previous FileIO versions) or fail, but I don't understand a partial fail.
Any ideas what could be the reason ?
I've attempted to make a MWE, but in a module, not totally a package, so the
init-equivalent step may not be relevant as such.