To write generic code that works on all platform I need a single method of writing paths. I chose the Posix method since Julia works well with it.
I used FilePathsBase methods to make a path from a string, and then dispatch on it based on the types that it detects, and then convert it back to string for my usage.
I do a lot of string interpolation, printing, etc, so I can’t use FilePaths for that (or makes things complex for no reason), and I should use strings.
""""
a lot of non path stuff with other string interpolations
"$goodpath/somefolder"
a lot of non path stuff with other string interpolations
"""
If I let the goodpath be a normal Windows Path like C:\\folder, when it is printed, it is converted to C:\folder which is not what I want.
The benefit of using FilePathsBase is its path detection regardless of what is given inside:
julia> using FilePathsBase
julia> p = Path("C:\\folder1/folder2")
p"C:/folder1/folder2"
julia> typeof(p)
WindowsPath
Probably this can be replaced with a simpler function. That questions the existence/implementation of FilePaths packages. Since everything can be replaced with Julia’s functions that work on strings rather tuple of strings…