Module Loading Case Sensitivity on Windows

question

#1

Hi all,

I’ve had some frustration when trying to load custom modules on Windows. Could someone clarify exactly what the case sensitivity rules are when trying to load modules, and any differences between file systems which are and are not case sensitive?

On Windows 10 (x64), I create the following file

module MyModule

println("Module loaded!")

end # module

and call it mymodule.jl. I put it in C:/Users/MyUserName/Desktop/test.

Then in the Julia v1.0.2 (x64) REPL I do the below:

julia> push!(LOAD_PATH,"C:/Users/MyUserName/Desktop/test")
4-element Array{String,1}:
 "@"
 "@v#.#"
 "@stdlib"
 "C:/Users/MyUserName/Desktop/test"

julia> using MyModule
ERROR: ArgumentError: Package MyModule not found in current path:
- Run `import Pkg; Pkg.add("MyModule")` to install the MyModule package.

Stacktrace:
 [1] require(::Module, ::Symbol) at .\loading.jl:823

Now I rename the file to MyModule.jl and repeat:

julia> push!(LOAD_PATH,"C:/Users/MyUserName/Desktop/test")
4-element Array{String,1}:
 "@"
 "@v#.#"
 "@stdlib"
 "C:/Users/MyUserName/Desktop/test"

julia> push!(LOAD_PATH,"C:/Users/MyUserName/Desktop/test")
4-element Array{String,1}:
 "@"
 "@v#.#"
 "@stdlib"
 "C:/Users/MyUserName/Desktop/test"

julia> using MyModule
[ Info: Recompiling stale cache file C:\Users\MyUserName\.julia\compiled\v1.0\MyModule.ji for MyModule [top-level]
Module loaded!

Hooray! Things work.

So questions:

  • Is this requirement documented anywhere?
  • How does this work if I say, clone someone’s repo who’s been on a case-insensitive filesystem?

The latter seems to be causing my issues. In that case, I think when Git hasn’t been setup to track case changes in file names, custom module loading can sometimes not work for inexplicable reasons.

Thoughts?