made it so that saved games are sorted by creation time instead of access time
This commit is contained in:
parent
a36816b827
commit
a03bea0350
3 changed files with 4 additions and 4 deletions
|
@ -270,9 +270,9 @@ bool file_exists(const std::string& name)
|
|||
return true;
|
||||
}
|
||||
|
||||
time_t file_last_access(const std::string& fname)
|
||||
time_t file_create_time(const std::string& fname)
|
||||
{
|
||||
struct stat buf;
|
||||
::stat(fname.c_str(),&buf);
|
||||
return buf.st_atime;
|
||||
return buf.st_mtime;
|
||||
}
|
|
@ -40,6 +40,6 @@ bool is_directory(const std::string& fname);
|
|||
//function which returns true iff file with name already exists
|
||||
bool file_exists(const std::string& name);
|
||||
|
||||
time_t file_last_access(const std::string& fname);
|
||||
time_t file_create_time(const std::string& fname);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -171,7 +171,7 @@ std::vector<save_info> get_saves_list()
|
|||
|
||||
std::vector<save_info> res;
|
||||
for(std::vector<std::string>::iterator i = saves.begin(); i != saves.end(); ++i) {
|
||||
const time_t modified = file_last_access(saves_dir + "/" + *i);
|
||||
const time_t modified = file_create_time(saves_dir + "/" + *i);
|
||||
|
||||
std::replace(i->begin(),i->end(),'_',' ');
|
||||
res.push_back(save_info(*i,modified));
|
||||
|
|
Loading…
Add table
Reference in a new issue