potential file metadata may only be in the first line of a file.
This commit is contained in:
@ -545,17 +545,15 @@ std::string utils::get_potential_file_path(const std::string& path) {
|
|||||||
std::string utils::get_potential_date(const std::string & path, const std::string & potential_name) {
|
std::string utils::get_potential_date(const std::string & path, const std::string & potential_name) {
|
||||||
TextFileReader reader(path, potential_name);
|
TextFileReader reader(path, potential_name);
|
||||||
reader.ignore_comments = false;
|
reader.ignore_comments = false;
|
||||||
char * line = nullptr;
|
|
||||||
|
|
||||||
while ((line = reader.next_line())) {
|
char *line = reader.next_line();
|
||||||
ValueTokenizer values(line);
|
ValueTokenizer values(line);
|
||||||
while (values.has_next()) {
|
while (values.has_next()) {
|
||||||
std::string word = values.next_string();
|
std::string word = values.next_string();
|
||||||
if (word == "DATE:") {
|
if (word == "DATE:") {
|
||||||
if (values.has_next()) {
|
if (values.has_next()) {
|
||||||
std::string date = values.next_string();
|
std::string date = values.next_string();
|
||||||
return date;
|
return date;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,17 +568,15 @@ std::string utils::get_potential_date(const std::string & path, const std::strin
|
|||||||
std::string utils::get_potential_units(const std::string & path, const std::string & potential_name) {
|
std::string utils::get_potential_units(const std::string & path, const std::string & potential_name) {
|
||||||
TextFileReader reader(path, potential_name);
|
TextFileReader reader(path, potential_name);
|
||||||
reader.ignore_comments = false;
|
reader.ignore_comments = false;
|
||||||
char * line = nullptr;
|
|
||||||
|
|
||||||
while ((line = reader.next_line())) {
|
char *line = reader.next_line();
|
||||||
ValueTokenizer values(line);
|
ValueTokenizer values(line);
|
||||||
while (values.has_next()) {
|
while (values.has_next()) {
|
||||||
std::string word = values.next_string();
|
std::string word = values.next_string();
|
||||||
if (word == "UNITS:") {
|
if (word == "UNITS:") {
|
||||||
if (values.has_next()) {
|
if (values.has_next()) {
|
||||||
std::string units = values.next_string();
|
std::string units = values.next_string();
|
||||||
return units;
|
return units;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user