|
|
|
@ -417,9 +417,10 @@ bool DataFlash_File::NeedPrep()
@@ -417,9 +417,10 @@ bool DataFlash_File::NeedPrep()
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
construct a log file name given a log number.
|
|
|
|
|
The number in the log filename will *not* be zero-padded. |
|
|
|
|
Note: Caller must free. |
|
|
|
|
*/ |
|
|
|
|
char *DataFlash_File::_log_file_name(const uint16_t log_num) const |
|
|
|
|
char *DataFlash_File::_log_file_name_short(const uint16_t log_num) const |
|
|
|
|
{ |
|
|
|
|
char *buf = nullptr; |
|
|
|
|
if (asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num) == -1) { |
|
|
|
@ -428,6 +429,39 @@ char *DataFlash_File::_log_file_name(const uint16_t log_num) const
@@ -428,6 +429,39 @@ char *DataFlash_File::_log_file_name(const uint16_t log_num) const
|
|
|
|
|
return buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
construct a log file name given a log number. |
|
|
|
|
The number in the log filename will be zero-padded. |
|
|
|
|
Note: Caller must free. |
|
|
|
|
*/ |
|
|
|
|
char *DataFlash_File::_log_file_name_long(const uint16_t log_num) const |
|
|
|
|
{ |
|
|
|
|
char *buf = nullptr; |
|
|
|
|
if (asprintf(&buf, "%s/%08u.BIN", _log_directory, (unsigned)log_num) == -1) { |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
return buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
return a log filename appropriate for the supplied log_num if a |
|
|
|
|
filename exists with the short (not-zero-padded name) then it is the |
|
|
|
|
appropirate name, otherwise the long (zero-padded) version is. |
|
|
|
|
Note: Caller must free. |
|
|
|
|
*/ |
|
|
|
|
char *DataFlash_File::_log_file_name(const uint16_t log_num) const |
|
|
|
|
{ |
|
|
|
|
char *filename = _log_file_name_short(log_num); |
|
|
|
|
if (filename == nullptr) { |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
if (file_exists(filename)) { |
|
|
|
|
return filename; |
|
|
|
|
} |
|
|
|
|
free(filename); |
|
|
|
|
return _log_file_name_long(log_num); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
return path name of the lastlog.txt marker file |
|
|
|
|
Note: Caller must free. |
|
|
|
|