Skip to content

creating file paths with embedded colons illegal under windows #3373

Closed
@philwalk

Description

@philwalk

The following code sequence in compile/test/dotty/tools/dotc/reporting/TestReporter.scala, lines 89 through 92 attempts to create a file with multiple embedded colons, throwing an exception in Windows:

    val df1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss")
    val folder = s"../testlogs/tests-${df0.format(date)}"
    new JFile(folder).mkdirs()
    outFile = new JFile(s"$folder/tests-${df1.format(date)}.log")
    outFile.createNewFile // added to trigger java.io.IOException locally, not in TestReporter.scala

Here's the exception:
java.io.FileNotFoundException: ..\testlogs\tests-2017-10-23\tests-2017-10-23-10:18:51.log (The filename, directory name, or volume label syntax is incorrect)

replacing colons with hyphens (or other legal path characters) in the SimpleDateFormat seems to fix the problem.

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