Skip to content

JLine eats backslashes on Windows #206

@Krasnyanskiy

Description

@Krasnyanskiy

I've found some weird behavior of FileNameCompleter on the app for Windows OS. When I try to complete a path to the file in Win console, JLine just ignores backslashes.

Example

$> operation C:\Some\Folder\File.zip

The app completes this path well, but in FileNameCompleter, I see a cleaned from backslashes buffer like this

C:SomeFolderFile.zip

and as result readLine() method returns a string without backslashes. To avoid such behavior I need to use double backslashes in the path (a customization of FileNameCompleter is needed here).

$> operation C:\\Some\\Folder\\File.zip

I also found this explanation:

A backslash - like is used in a file path - can't be used directly in a Java String. Java uses the backslash to mean “the next character means something special”. Doubling the backslash in Java indicates that “the next character (the second backslash) should be inserted into the String”.

Maybe there is some solution of this issue in Jline out the box which I just overlooked? Maybe some option which I need to activate to force JLine understand single backslashes?

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