From 98c99172c0829bd593d8eab7abc4cc01416037a2 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 23 May 2010 23:53:17 +0000 Subject: [PATCH] fixed check free space for the portable version in windows git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2986 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/util/rsdiscspace.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/util/rsdiscspace.cc b/libretroshare/src/util/rsdiscspace.cc index 5d12b045f..8a5746e6e 100644 --- a/libretroshare/src/util/rsdiscspace.cc +++ b/libretroshare/src/util/rsdiscspace.cc @@ -61,9 +61,15 @@ bool RsDiscSpace::crossSystemDiskStats(const char *file, uint32_t& free_blocks, szDrive[1] = file[1] ; szDrive[2] = file[2] ; #else - char szDrive[4]; + char szDrive[4] = ""; - memcpy (szDrive, file, 3); + char *pszFullPath = _fullpath (NULL, file, 0); + if (pszFullPath == 0) { + std::cerr << "Size estimate failed for drive (_fullpath) " << szDrive << std::endl ; + return false; + } + _splitpath (pszFullPath, szDrive, NULL, NULL, NULL); + free (pszFullPath); #endif szDrive[3] = 0;