mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-17 05:06:55 +02:00
Implement feature request to mark partially-downloaded files as .partial (#1868)
* Implement feature request to mark partially-downloaded files as .partial during download
This commit is contained in:
parent
3124b2dcf2
commit
a5bd4e9133
|
@ -1158,8 +1158,13 @@ final class OneDriveApi
|
||||||
{
|
{
|
||||||
// Threshold for displaying download bar
|
// Threshold for displaying download bar
|
||||||
long thresholdFileSize = 4 * 2^^20; // 4 MiB
|
long thresholdFileSize = 4 * 2^^20; // 4 MiB
|
||||||
// open file as write in binary mode
|
|
||||||
auto file = File(filename, "wb");
|
// To support marking of partially-downloaded files,
|
||||||
|
string originalFilename = filename;
|
||||||
|
string downloadFilename = filename ~ ".partial";
|
||||||
|
|
||||||
|
// open downloadFilename as write in binary mode
|
||||||
|
auto file = File(downloadFilename, "wb");
|
||||||
|
|
||||||
// function scopes
|
// function scopes
|
||||||
scope(exit) {
|
scope(exit) {
|
||||||
|
@ -1253,6 +1258,9 @@ final class OneDriveApi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename downloaded file
|
||||||
|
rename(downloadFilename, originalFilename);
|
||||||
|
|
||||||
// Check the HTTP response code, which, if a 429, will also check response headers
|
// Check the HTTP response code, which, if a 429, will also check response headers
|
||||||
checkHttpCode();
|
checkHttpCode();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue