WesleyyC / Image-Editor

A command line image editor written in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to take in file path with empty space

SerinaTan opened this issue · comments

The Scanner class method next() uses empty space as a delimiter, so any file path with an empty space will be split into two different commands.

using nextLine() should fix the problem.

Changed next() to nextLine() and it is fixed. Closing.

I have tried to use nextLine() for the input path. It does not like it.

I pulled and checked. Should be good to go. Have no idea what happens when I tried it this afternoon. Awesome.

Haha. That happens:) But feel free to reopen this issue if you find it not working again.

When the path does not has an empty space, the load function does not work.

That is... New... and Surprising.... I will take a look tomorrow.......

Actually.. I just had a try... It works well with me. Could you give a detailed example?

I see what's going on. There cannot be a whitespace after the whole path. So "/Users/wesley/Desktop/imgres.jpg" will work, but "/Users/wesley/Desktop/imgres.jpg " won't.

Well we shouldn't punish users for adding extra space at the end. I added a trim() to the string we get in. Adding space at the end/beginning of the file path/command should also work now.