I'm sorry if I'm jumping from a problem to another, but to check HMG4 I'm porting my projects and test.
Anyway, at the beginning of my program I read a configuration file and set up directory with Harbour/XBase commands:
Code: Select all
SET( _SET_PATH,.... )
Code: Select all
SET( _SET_DEFAULT,.....)
I've used GetCurrentFolder() function (dialogs.prg), but the result is not quite correct when used in a MsWin. I see "/" instead of "\".
This function use returned value of QDir():currentPath(). Yes, I know, many HARBOUR functions are able to use this value... I believe that many developers could have written its own functions based on the Microsoft operating system.
I've read QT documentation here(http://doc.qt.nokia.com/latest/qdir.htm ... Separators) and this could be the solution:
Code: Select all
FUNCTION GetCurrentFolder()
RETURN QDir():toNativeSeparators( QDir():currentPath() )
<<Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
On Windows, toNativeSeparators("c:/winnt/system32") returns "c:\winnt\system32".
The returned string may be the same as the argument on some operating systems, for example on Unix.
This function was introduced in Qt 4.2.>>
This is the opposite function: cQtStyledPath := QDir():fromNativeSeparators( PathName )
Today, the Harbour compiler provides some additional function (Attention: don't use "CurDir()". My opinion is that the value returned is not usable).
I would be the idea to use this UDF rather than those made available to QT, and so we give an example
Code: Select all
FUNCTION GetCurrentFolder()
LOCAL cPath, cFile, cExt, cDrive
HB_FNAMESPLIT( HB_PROGNAME(), @cPath, @cFile, NIL, NIL )
RETURN cPath
This is the same as QDir():toNativeSeparators( QDir():currentPath() ) but with Harbour compiler functions.
What do you think?