mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 05:43:34 +00:00
added fill_str_dated_filename() function
This function creates a 'dated' filename prefixed by the string `in_str`, and concatenates extension (`ext`) to it.
This commit is contained in:
parent
4b9ced1cd8
commit
4e44ab99a1
@ -423,6 +423,32 @@ void fill_dated_filename(char *out_filename,
|
|||||||
strlcat(out_filename, ext, size);
|
strlcat(out_filename, ext, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fill_str_dated_filename:
|
||||||
|
* @out_filename : output filename
|
||||||
|
* @in_str : input string
|
||||||
|
* @ext : extension of output filename
|
||||||
|
* @size : buffer size of output filename
|
||||||
|
*
|
||||||
|
* Creates a 'dated' filename prefixed by the string @in_str, and
|
||||||
|
* concatenates extension (@ext) to it.
|
||||||
|
*
|
||||||
|
* E.g.:
|
||||||
|
* out_filename = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}"
|
||||||
|
**/
|
||||||
|
void fill_str_dated_filename(char *out_filename,
|
||||||
|
const char *in_str, const char *ext, size_t size)
|
||||||
|
{
|
||||||
|
char format[PATH_MAX_LENGTH] = {0};
|
||||||
|
time_t cur_time;
|
||||||
|
time(&cur_time);
|
||||||
|
|
||||||
|
snprintf(format, sizeof(format),
|
||||||
|
"%s-%%y%%m%%d-%%H%%M%%S.", in_str);
|
||||||
|
strftime(out_filename, size, format, localtime(&cur_time));
|
||||||
|
strlcat(out_filename, ext, size);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path_basedir:
|
* path_basedir:
|
||||||
* @path : path
|
* @path : path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user