Skip to content

joinpath behave weirdly when forbidden characters are used on windows #58929

@LouisPauchet

Description

@LouisPauchet

Description:

When using joinpath on Windows, instead of the full path returned, only the last element is returned.

Bug Steps

using Dates

function bug_test(folder::String, config_prefix::String)
    timestamp = Dates.format(now(), "yyyy-mm-dd_HH:MM:SS")
    log_file = abspath(joinpath(folder, "run_$(timestamp)_$(config_prefix).log"))
    log_file_jp = joinpath(folder, "run_$(timestamp)_$(config_prefix).log")
    println("Folder : $folder")
    println("Full path to log : $log_file_jp")
    println("Full abspath to log : $log_file")
end
pwsh>julia --threads=auto
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.5 (2025-04-14)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> include("./bug.jl")
bug_test (generic function with 1 method)

julia> cd("C:\\test")

julia> bug_test(raw"C:/test/01","01")
Folder : C:/test/01
Full path to log : run_2025-07-08_12:01:57_01.log
Full abspath to log : run_2025-07-08_12:01:57_01.log

julia> bug_test("C:\\test\\01","01")
Folder : C:\test\01
Full path to log : run_2025-07-08_12:02:02_01.log
Full abspath to log : run_2025-07-08_12:02:02_01.log

julia> bug_test(raw"C:/test/01","01")
Folder : C:/test/01
Full path to log : run_2025-07-08_12:02:09_01.log
Full abspath to log : run_2025-07-08_12:02:09_01.log

Version
Julia Version : 1.11.5
Powershell : 7.5.2
Windows 11 Enterprise 24H2 (26100.4061)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions