mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/win32-vd_agent
synced 2026-01-09 14:11:34 +00:00
file_xfer: Separate code to get download directory location
Allows to reuse code to get download directory. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
7a7c3b22e2
commit
5fbeb1af4e
@ -48,6 +48,16 @@ FileXfer::~FileXfer()
|
||||
{
|
||||
}
|
||||
|
||||
static bool get_download_directory(TCHAR file_path[MAX_PATH])
|
||||
{
|
||||
if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, file_path))) {
|
||||
vd_printf("failed getting desktop path");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileXfer::handle_start(VDAgentFileXferStartMessage* start,
|
||||
VDAgentFileXferStatusMessage* status)
|
||||
{
|
||||
@ -77,9 +87,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start,
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, file_path))) {
|
||||
vd_printf("failed getting desktop path");
|
||||
if (!get_download_directory(file_path)) {
|
||||
return;
|
||||
}
|
||||
if (!GetDiskFreeSpaceEx(file_path, &free_bytes, NULL, NULL)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user