On Fri, 06 Feb 2009, Enrico Maria Giordano wrote:

Hi,

> 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:\

Thank you for test.
BTW why leading dot (.) in missing in logical results?
Typo or some other problem?

>> 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.

But it also says:
,----------------------------------------------------------------------------
| Note  Although each process can have only one current directory, if the
|       application switches volumes using the SetCurrentDirectory function,
|       the system remembers the last current path for each volume (drive
|       letter). This behavior will manifest itself only when specifying a
|       drive letter without a fully qualified path when changing the current
|       directory point of reference to a different volume. This applies to
|       either Get or Set operations.
`----------------------------------------------------------------------------

So were is the true ;-)
Can you repeat your test without using any [x]Harbour functions like
CurDrive() or CurDir() but the following GetCurrentDirectory() instead:

HB_FUNC( GETCURRENTDIRECTORY )
{
   char szPath[ MAX_PATH ];
   if( GetCurrentDirectory( MAX_PATH, szPath ) )
      hb_retc( szPath );
}

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to