JuliaPackaging/RelocatableFolders.jl

RelocatableFolders does not handle removed files?

Closed this issue · 0 comments

We encountered it originally while trying to compile a server app with swagger spec, and it didn't work for some reason: GenieFramework/SwaggerMarkdown.jl#8

That is strange, because it worked in Oxygen https://github.com/ndortega/Oxygen.jl/pull/128/files

Looks like it works with entire folder but not with a single file:

import Pkg
Pkg.activate(; temp=true)
Pkg.add("RelocatableFolders")

open("test1.txt", "w") do io
    write(io, "some data")
end

mkdir("subfolder")
open("subfolder/test2.txt", "w") do io
    write(io, "another data")
end

module MyTest
    using RelocatableFolders 
    const FILE = @path joinpath(@__DIR__, "test1.txt")
    const FOLDER = @path joinpath(@__DIR__, "subfolder")
    read_from_file() = read(FILE, String)
    read_from_folder() = read(joinpath(FOLDER, "test2.txt"), String)
end

using .MyTest
MyTest.read_from_file() # ok
MyTest.read_from_folder() # ok

rm("subfolder"; recursive = true)
MyTest.read_from_folder() # ok

rm("test1.txt")
MyTest.read_from_file() # error