-----Messaggio Originale----- Da: "Przemyslaw Czerpak" <dru...@acn.waw.pl>
A: "Harbour Project Main Developer List." <harbour@harbour-project.org>
Data invio: venerdì 6 febbraio 2009 10.58
Oggetto: Re: [Harbour] curdir() and cross platform compatibility


I have a questions for Windows users.
Can we use SetCurrentDirectory() with only drive signature (f.e. "D:")
to change to recently set current path for drive "D:"? Looking at
MS documentation seems that it should work but I would like to confirm
it.

It seems not. The following sample:

FUNCTION MAIN()

   LOCAL cCurDir := CURDRIVE() + ":\" + CURDIR()

   ? cCurDir

   ? SETCURRENTDIRECTORY( "C:\WINDOWS" )

   ? SETCURRENTDIRECTORY( cCurDir )

   ? SETCURRENTDIRECTORY( "C:" )

   ? CURDRIVE() + ":\" + CURDIR()

   INKEY( 0 )

   RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"


HB_FUNC( SETCURRENTDIRECTORY )
{
   hb_retl( SetCurrentDirectory( hb_parc( 1 ) ) );
}

#pragma ENDDUMP

prints:

E:\HARBOUR
T.
T.
T.
C:\

From the MSDN:

"The final character before the null character must be a backslash ('\'). If you do not specify the backslash, it will be added for you;"

So it seems that it changes the current directory to the root of the specified drive.

EMG

--
EMAG Software Homepage:     http://www.emagsoftware.it
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg
The EMG Music page: http://www.emagsoftware.it/emgmusic
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to