Reputation: 17121
This is supposed to prefix the given path:
date = Date(2016, 6, 3)
const FILEDATE_FORMAT = "YYYYmmdd"
const FILE_PATH_FORMAT = "/YYYY/mm/"
joinpath(
"path-prefix",
Dates.format(DateTime(date), FILE_PATH_FORMAT),
Dates.format(DateTime(date), FILEDATE_FORMAT)
)
Expected: "/path-prefix/2016/06/20160603"
Actual: "/2016/06/20160603"
What is wrong here?
Upvotes: 2
Views: 221
Reputation: 18560
On Linux, /
is the root directory. Since your FILE_PATH_FORMAT
begins with the character /
, joinpath
is interpreting this as the root directory, and, as per the behaviour of that function, everything that comes before it is omitted since the path is already absolute.
The solution is to just drop the leading /
from FILE_PATH_FORMAT
.
By the way, I need to use yyyy
, not YYYY
on my system. Not sure why YYYY
works for you...
Upvotes: 5