mirror of
https://github.com/monero-project/monero.git
synced 2025-05-03 21:44:54 -04:00
Merge pull request #2929
ae55bacd
resumption support for updates using range requests (moneromooo-monero)fe0fae50
epee: add a get_file_size function (moneromooo-monero)
This commit is contained in:
commit
b38f6dcf0b
3 changed files with 104 additions and 12 deletions
|
@ -133,6 +133,26 @@ namespace file_io_utils
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
bool get_file_size(const std::string& path_to_file, uint64_t &size)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::ifstream fstream;
|
||||
fstream.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
fstream.open(path_to_file, std::ios_base::binary | std::ios_base::in | std::ios::ate);
|
||||
size = fstream.tellg();
|
||||
fstream.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
catch(...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue