Commit 02526eda authored by Max Kellermann's avatar Max Kellermann

text_file: don't strip trailing whitespace

Only delete the newline characters (\n and optionally \r). This allows the database file to store file names with trailing whitespace.
parent 828a5f55
...@@ -57,7 +57,12 @@ read_text_line(FILE *file, GString *buffer) ...@@ -57,7 +57,12 @@ read_text_line(FILE *file, GString *buffer)
g_string_set_size(buffer, length + step); g_string_set_size(buffer, length + step);
} }
/* remove the newline characters */
if (buffer->str[length - 1] == '\n')
--length;
if (buffer->str[length - 1] == '\r')
--length;
g_string_set_size(buffer, length); g_string_set_size(buffer, length);
g_strchomp(buffer->str);
return buffer->str; return buffer->str;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment