diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aa956473d6..49f19e0d9b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -5,6 +5,7 @@ * source/rtl/diskspac.c ! Fixed the default case for Win32. + ! Fixed to accept a numeric parameter instead of a string. * source/rtl/getenv.c ! Fixed to not modify the item buffer directly. diff --git a/harbour/source/rtl/diskspac.c b/harbour/source/rtl/diskspac.c index 043ce18142..703d010d12 100644 --- a/harbour/source/rtl/diskspac.c +++ b/harbour/source/rtl/diskspac.c @@ -46,23 +46,20 @@ #define HB_OS_WIN_32_USED -#include - #include "hbapi.h" #include "hbapierr.h" #include "hbapifs.h" -#if defined(DOS) || defined(__WATCOMC__) +#if defined(HB_OS_DOS) || defined(__WATCOMC__) #include #endif HARBOUR HB_DISKSPACE( void ) { ULONG ulSpaceFree = 0; - USHORT uiDrive = ( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 ) ? - ( USHORT )( toupper( *hb_parc( 1 ) ) - 'A' + 1 ) : 0; + USHORT uiDrive = ISNUM( 1 ) ? hb_parni( 1 ) : 0; -#if defined(DOS) || defined(__WATCOMC__) +#if defined(HB_OS_DOS) || defined(__WATCOMC__) struct diskfree_t disk; unsigned uiResult; @@ -90,9 +87,17 @@ HARBOUR HB_DISKSPACE( void ) DWORD dwNumberOfFreeClusters; DWORD dwTotalNumberOfClusters; + /* Get the default drive */ + if( uiDrive == 0 ) + { + USHORT uiErrorOld = hb_fsError(); + uiDrive = hb_fsCurDrv() + 1; + hb_fsSetError( uiErrorOld ); + } + szPath[ 0 ] = uiDrive + 'A' - 1; szPath[ 1 ] = ':'; szPath[ 2 ] = '\\';