file: Strip leading whitespace when reading strings
This was a bug I discovered when double clicking on paths in the collection manager to change the path in the FileChooserWidget. Before this patch, strings could be read as: <string> /home/anna/Music</string> Now, the same string will be read as: <string>/home/anna/Music</string> Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
b50aaa8d9e
commit
aa21ab5602
|
@ -150,7 +150,13 @@ void File :: close()
|
|||
|
||||
std::string File :: getline()
|
||||
{
|
||||
char c;
|
||||
std::string res;
|
||||
|
||||
/* Ignore leading whitespace */
|
||||
while (peek() == ' ')
|
||||
read(&c, 1);
|
||||
|
||||
std::getline(*static_cast<std::fstream *>(this), res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -178,14 +178,14 @@ Test 3d
|
|||
Allocated rows: 0
|
||||
Valid rows: 0
|
||||
Test 3e
|
||||
Added library 0: /tmp/library/0
|
||||
Added library 1: /tmp/library/1
|
||||
Added library 2: /tmp/library/2
|
||||
Added library 0: /tmp/library/0
|
||||
Added library 1: /tmp/library/1
|
||||
Added library 2: /tmp/library/2
|
||||
Allocated rows: 3
|
||||
Valid rows: 3
|
||||
db[0] = /tmp/library/0 (enabled), size = 0
|
||||
db[1] = /tmp/library/1 (enabled), size = 0
|
||||
db[2] = /tmp/library/2 (enabled), size = 0
|
||||
db[0] = /tmp/library/0 (enabled), size = 150
|
||||
db[1] = /tmp/library/1 (enabled), size = 150
|
||||
db[2] = /tmp/library/2 (enabled), size = 150
|
||||
|
||||
Test 4a: Added library 0: /tmp/library/0
|
||||
PASSED
|
||||
|
|
Loading…
Reference in New Issue