2011-02-10 13:33 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/make.hbs
  * contrib/hbide/idemisc.prg
  * contrib/hbide/idefunctions.prg
  * contrib/hbide/ideprojmanager.prg
  * contrib/hbrun/hbrun.prg
  * config/postinst.hbs
  * bin/hb3rdpat.hbs
    * Using new filename handling functions from core.
    % Deleted redundant local copies of these functions.

  * utils/hbmk2/hbmk2.prg
    + REQUESTing new filename handling function till they are
      used in hbmk2 too.
    ; TODO: Make the switch in hbmk2 too.
This commit is contained in:
Viktor Szakats
2011-02-10 12:34:30 +00:00
parent 19db5041b5
commit 96ec4a7825
9 changed files with 55 additions and 365 deletions

View File

@@ -16,6 +16,22 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-02-10 13:33 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/make.hbs
* contrib/hbide/idemisc.prg
* contrib/hbide/idefunctions.prg
* contrib/hbide/ideprojmanager.prg
* contrib/hbrun/hbrun.prg
* config/postinst.hbs
* bin/hb3rdpat.hbs
* Using new filename handling functions from core.
% Deleted redundant local copies of these functions.
* utils/hbmk2/hbmk2.prg
+ REQUESTing new filename handling function till they are
used in hbmk2 too.
; TODO: Make the switch in hbmk2 too.
2011-02-10 12:19 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbmysql/hbmysql.hbc
* contrib/sddpg/sddpg.hbc
@@ -1446,7 +1462,7 @@
hb_FNameDirExtSet( <cFileName>, <cDirNew>, <cExtNew> ) -> <cFileName>
; TODO: Review, clean interface. [DONE]
; TODO: Use these functions in .hbs files, utils, hbide.
; TODO: Use these functions in .hbs files, utils, hbide. [DONE]
* include/harbour.hbx
* Updated.

View File

@@ -346,8 +346,8 @@ PROCEDURE Main( ... )
aRegexMatch[ TWOARG_ARG1 ] := StrTran( aRegexMatch[ TWOARG_ARG1 ], "/", hb_ps() )
ENDIF
/* The destination argument must fit in the 8+3 scheme */
IF Len( FNameNameGet( aRegexMatch[ TWOARG_ARG2 ] ) ) > 8 .OR. ;
Len( FNameExtGet( aRegexMatch[ TWOARG_ARG2 ] ) ) > 3
IF Len( hb_FNameName( aRegexMatch[ TWOARG_ARG2 ] ) ) > 8 .OR. ;
Len( hb_FNameExt( aRegexMatch[ TWOARG_ARG2 ] ) ) > 3
OutStd( hb_strFormat( "E: Destination does not fit 8+3, offending "+ ;
"line %d:%s", nMemoLine, hb_eol() ) )
OutStd( aRegexMatch[ 1 ] + hb_eol() )
@@ -397,11 +397,11 @@ PROCEDURE Main( ... )
cRoot := cCWD + hb_ps()
#endif
FClose( hb_FTempCreateEx( @s_cTempDir, cRoot, FNameNameGet( hb_ProgName() ) + "_" ) )
FClose( hb_FTempCreateEx( @s_cTempDir, cRoot, hb_FNameName( hb_ProgName() ) + "_" ) )
FErase( s_cTempDir )
hb_DirCreate( s_cTempDir )
cThisComponent := FNameNameGet( cCWD )
cThisComponent := hb_FNameName( cCWD )
hb_DirCreate( CombinePath( s_cTempDir, cThisComponent ) )
hb_DirCreate( CombinePath( s_cTempDir, cThisComponent + ".orig" ) )
@@ -687,7 +687,7 @@ STATIC FUNCTION FetchAndExtract( cArchiveURL )
IF cArchiver == NIL
OutStd( "E: Can not find archiver for `" + ;
FNameNameExtGet( cArchiveURL ) + "'" + hb_eol() )
hb_FNameNameExt( cArchiveURL ) + "'" + hb_eol() )
RETURN .F.
ENDIF
@@ -765,47 +765,13 @@ STATIC PROCEDURE SaveLog( cFNTemplate, cStdOut, cStdErr )
STATIC PROCEDURE Usage( nExitVal )
OutStd( "Usage: " + FNameNameExtGet( hb_ProgName() ) + " [-h|-help|-rediff]" + hb_eol() )
OutStd( "Usage: " + hb_FNameNameExt( hb_ProgName() ) + " [-h|-help|-rediff]" + hb_eol() )
OutStd( " Documentation is provided in the source code." + hb_eol() )
ErrorLevel( nExitVal )
QUIT
RETURN
/* from hbmk2 */
STATIC FUNCTION FNameDirGet( cFileName )
LOCAL cDir
hb_FNameSplit( cFileName, @cDir )
RETURN cDir
STATIC FUNCTION FNameNameGet( cFileName )
LOCAL cName
hb_FNameSplit( cFileName,, @cName )
RETURN cName
STATIC FUNCTION FNameNameExtGet( cFileName )
LOCAL cName, cExt
hb_FNameSplit( cFileName,, @cName, @cExt )
RETURN hb_FNameMerge( NIL, cName, cExt )
STATIC FUNCTION FNameExtGet( cFileName )
LOCAL cExt
hb_FNameSplit( cFileName,,, @cExt )
RETURN cExt
STATIC FUNCTION URL_GetFileName( cURL )
LOCAL aComponents
@@ -851,7 +817,7 @@ STATIC FUNCTION hb_FileTran( cFileName )
/* This is a shot in the dark. Haru works with this transform,
* but other components may very well need different handling. */
cChangeFrom := FNameNameExtGet( aChange[ 1 ] )
cChangeFrom := hb_FNameNameExt( aChange[ 1 ] )
cChangeTo := aChange[ 2 ]
/* Local-style includes */

View File

@@ -63,7 +63,7 @@ PROCEDURE Main( ... )
OutStd( "! Copying root documents..." + hb_eol() )
IF DirBuild( tmp )
IF hb_DirBuild( PathSepToSelf( tmp ) )
FOR EACH aFile IN Directory( "Change*" )
mk_hb_FCopy( aFile[ F_NAME ], tmp + hb_ps() + iif( GetEnvC( "HB_PLATFORM" ) == "dos", "CHANGES", "" ) )
NEXT
@@ -93,7 +93,7 @@ PROCEDURE Main( ... )
OutStd( "! Copying *nix config files..." + hb_eol() )
IF DirBuild( GetEnvC( "HB_INSTALL_ETC" ) )
IF hb_DirBuild( PathSepToSelf( GetEnvC( "HB_INSTALL_ETC" ) ) )
mk_hb_FCopy( "src/rtl/gtcrs/hb-charmap.def", GetEnvC( "HB_INSTALL_ETC" ) + hb_ps(), .T. )
ELSE
OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", GetEnvC( "HB_INSTALL_ETC" ) ) + hb_eol() )
@@ -104,7 +104,7 @@ PROCEDURE Main( ... )
OutStd( "! Creating *nix ld config file..." + hb_eol() )
tmp := GetEnvC( "HB_INSTALL_ETC" ) + hb_ps() + ".." + hb_ps() + "ld.so.conf.d"
IF DirBuild( tmp )
IF hb_DirBuild( PathSepToSelf( tmp ) )
tmp1 := GetEnvC( "HB_INSTALL_DYN" )
IF Left( tmp1, Len( GetEnvC( "HB_INSTALL_PKG_ROOT" ) ) ) == GetEnvC( "HB_INSTALL_PKG_ROOT" )
tmp1 := SubStr( tmp1, Len( GetEnvC( "HB_INSTALL_PKG_ROOT" ) ) + 1 )
@@ -120,7 +120,7 @@ PROCEDURE Main( ... )
OutStd( "! Copying *nix man files..." + hb_eol() )
IF DirBuild( GetEnvC( "HB_INSTALL_MAN" ) + hb_ps() + "man1" )
IF hb_DirBuild( PathSepToSelf( GetEnvC( "HB_INSTALL_MAN" ) ) + hb_ps() + "man1" )
FOR EACH tmp IN { "src/main/harbour.1" ,;
"src/pp/hbpp.1" ,;
"utils/hbmk2/hbmk2.1" ,;
@@ -182,7 +182,7 @@ PROCEDURE Main( ... )
IF "D" $ tmp[ F_ATTR ] .AND. !( tmp[ F_NAME ] == "." ) .AND. !( tmp[ F_NAME ] == ".." )
FOR EACH aFile IN Directory( "utils" + hb_ps() + tmp[ F_NAME ] + hb_ps() + "*.po" )
mk_hbl( "utils" + hb_ps() + tmp[ F_NAME ] + hb_ps() + aFile[ F_NAME ],;
PathSepToSelf( GetEnvC( "HB_INSTALL_BIN" ) ) + hb_ps() + FNameExtSet( aFile[ F_NAME ], ".hbl" ) )
PathSepToSelf( GetEnvC( "HB_INSTALL_BIN" ) ) + hb_ps() + hb_FNameExtSet( aFile[ F_NAME ], ".hbl" ) )
NEXT
ENDIF
NEXT
@@ -383,105 +383,9 @@ STATIC FUNCTION mk_hb_processRun( cCommand, ... )
STATIC FUNCTION FNameEscape( cFN )
RETURN Chr( 34 ) + cFN + Chr( 34 )
STATIC FUNCTION FNameExtSet( cFileName, cExt )
LOCAL cDir, cName
hb_FNameSplit( cFileName, @cDir, @cName )
RETURN hb_FNameMerge( cDir, cName, cExt )
STATIC FUNCTION PathSepToSelf( cFileName )
RETURN StrTran( cFileName, iif( hb_ps() == "\", "/", "\" ), hb_ps() )
STATIC FUNCTION DirBuild( cDir )
LOCAL cDirTemp
LOCAL cDirItem
LOCAL tmp
cDir := PathNormalize( PathSepToSelf( cDir ) )
IF ! hb_DirExists( cDir )
cDir := DirAddPathSep( cDir )
IF ! Empty( hb_osDriveSeparator() ) .AND. ;
( tmp := At( hb_osDriveSeparator(), cDir ) ) > 0
cDirTemp := Left( cDir, tmp )
cDir := SubStr( cDir, tmp + 1 )
ELSEIF Left( cDir, 1 ) == hb_ps()
cDirTemp := Left( cDir, 1 )
cDir := SubStr( cDir, 2 )
ELSE
cDirTemp := ""
ENDIF
FOR EACH cDirItem IN hb_ATokens( cDir, hb_ps() )
IF !( Right( cDirTemp, 1 ) == hb_ps() ) .AND. ! Empty( cDirTemp )
cDirTemp += hb_ps()
ENDIF
IF ! Empty( cDirItem ) /* Skip root path, if any */
cDirTemp += cDirItem
IF hb_FileExists( cDirTemp )
RETURN .F.
ELSEIF ! hb_DirExists( cDirTemp )
IF hb_DirCreate( cDirTemp ) != 0
RETURN .F.
ENDIF
ENDIF
ENDIF
NEXT
ENDIF
RETURN .T.
#define _ISDRIVESPEC( cDir ) ( ! Empty( hb_osDriveSeparator() ) .AND. Right( cDir, Len( hb_osDriveSeparator() ) ) == hb_osDriveSeparator() )
/* NOTE: Can hurt if there are symlinks on the way. */
STATIC FUNCTION PathNormalize( cPath )
LOCAL aDir
LOCAL cDir
IF ! Empty( cPath )
aDir := hb_ATokens( cPath, hb_ps() )
FOR EACH cDir IN aDir DESCEND
IF cDir == "."
hb_ADel( aDir, cDir:__enumIndex(), .T. )
ELSEIF !( cDir == ".." ) .AND. ;
! Empty( cDir ) .AND. ;
! _ISDRIVESPEC( cDir )
IF cDir:__enumIndex() < Len( cDir:__enumBase() ) .AND. ;
aDir[ cDir:__enumIndex() + 1 ] == ".."
hb_ADel( aDir, cDir:__enumIndex() + 1, .T. )
hb_ADel( aDir, cDir:__enumIndex(), .T. )
ENDIF
ENDIF
NEXT
cPath := ""
FOR EACH cDir IN aDir
cPath += cDir
IF cDir:__enumIndex() < Len( cDir:__enumBase() )
cPath += hb_ps()
ENDIF
NEXT
IF Empty( cPath )
cPath := "." + hb_ps()
ENDIF
ENDIF
RETURN cPath
STATIC FUNCTION DirAddPathSep( cDir )
IF ! Empty( cDir ) .AND. !( Right( cDir, 1 ) == hb_ps() )
cDir += hb_ps()
ENDIF
RETURN cDir
/* Like hb_FCopy(), but accepts dir as target and can set attributes */
STATIC PROCEDURE mk_hb_FCopy( cSrc, cDst, l644 )
LOCAL cDir, cName, cExt
@@ -696,7 +600,7 @@ STATIC FUNCTION __hb_extern_gen( aFuncList, cOutputName )
LOCAL aInclude
LOCAL aExclude
LOCAL cSelfName := _HB_SELF_PREFIX + Upper( __FNameNameGet( cOutputName ) ) + _HB_SELF_SUFFIX
LOCAL cSelfName := _HB_SELF_PREFIX + Upper( hb_FNameName( cOutputName ) ) + _HB_SELF_SUFFIX
LOCAL cLine := "/* -------------------------------------------------------------------- */" + hb_eol()
LOCAL cHelp := "/* Syntax: // HB_FUNC_INCLUDE <func> */" + hb_eol() +;
@@ -742,8 +646,8 @@ STATIC FUNCTION __hb_extern_gen( aFuncList, cOutputName )
cExtern += "/* compiler family. [vszakats] */" + hb_eol()
cExtern += cLine
cExtern += hb_eol()
cExtern += "#ifndef " + "__HBEXTERN_CH__" + Upper( __FNameNameGet( cOutputName ) ) + "__" + hb_eol()
cExtern += "#define " + "__HBEXTERN_CH__" + Upper( __FNameNameGet( cOutputName ) ) + "__" + hb_eol()
cExtern += "#ifndef " + "__HBEXTERN_CH__" + Upper( hb_FNameName( cOutputName ) ) + "__" + hb_eol()
cExtern += "#define " + "__HBEXTERN_CH__" + Upper( hb_FNameName( cOutputName ) ) + "__" + hb_eol()
cExtern += hb_eol()
cExtern += "#if defined( __HBEXTREQ__ ) .OR. defined( " + cSelfName + "ANNOUNCE" + " )" + hb_eol()
cExtern += " ANNOUNCE " + cSelfName + hb_eol()
@@ -778,10 +682,3 @@ STATIC FUNCTION __hb_extern_gen( aFuncList, cOutputName )
cExtern += "#endif" + hb_eol()
RETURN hb_MemoWrit( cOutputName, cExtern )
STATIC FUNCTION __FNameNameGet( cFileName )
LOCAL cName
hb_FNameSplit( cFileName,, @cName )
RETURN cName

View File

@@ -439,7 +439,7 @@ METHOD IdeFunctions:loadTags( aProjects )
FOR EACH cProjectTitle IN a_
cProjFile := ::oPM:getProjectFileNameFromTitle( cProjectTitle )
IF ! empty( cProjFile ) .AND. hb_fileExists( cProjFile )
cTagFile := FNameExtSet( cProjFile, ".tag" )
cTagFile := hb_FNameExtSet( cProjFile, ".tag" )
IF hb_fileExists( cTagFile )
lPopulate := .t.
@@ -536,7 +536,7 @@ METHOD IdeFunctions:tagProject( cProjectTitle )
::aTags[ n, 2 ] := aCTags
ENDIF
hb_memowrit( FNameExtSet( cProjFile, ".tag" ), hb_serialize( aCTags ) )
hb_memowrit( hb_FNameExtSet( cProjFile, ".tag" ), hb_serialize( aCTags ) )
::consolidateList()
::populateTable()

View File

@@ -49,18 +49,6 @@
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://harbour-project.org
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* hbide_PathMakeAbsolute(), hbide_DirAddPathSep(), DirDelPathSep()
* hbide_pwd()
*
* See COPYING for licensing terms.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
@@ -917,34 +905,6 @@ FUNCTION hbide_checkDefaultExtension( cFileName, cDefaultExt )
/*----------------------------------------------------------------------*/
FUNCTION hbide_PathMakeAbsolute( cPathR, cPathA )
LOCAL cDirA, cDirR, cDriveR, cNameR, cExtR
IF Empty( cPathA )
RETURN cPathR
ENDIF
hb_FNameSplit( cPathR, @cDirR, @cNameR, @cExtR, @cDriveR )
IF ! Empty( cDriveR ) .OR. ( ! Empty( cDirR ) .AND. Left( cDirR, 1 ) $ hb_osPathDelimiters() )
RETURN cPathR
ENDIF
hb_FNameSplit( cPathA, @cDirA )
IF Empty( cDirA )
RETURN cPathR
ENDIF
RETURN hb_FNameMerge( cDirA + cDirR, cNameR, cExtR )
/*----------------------------------------------------------------------*/
FUNCTION hbide_pwd()
RETURN hbide_DirAddPathSep( hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir() )
/*----------------------------------------------------------------------*/
function hbide_toString( x, lLineFeed, lInherited, lType, cFile, lForceLineFeed )
LOCAL s := ''
LOCAL t := valtype( x )
@@ -1519,31 +1479,6 @@ FUNCTION hbide_outputLine( cLine, nOccur )
/*----------------------------------------------------------------------*/
FUNCTION hbide_DirAddPathSep( cDir )
IF ! Empty( cDir ) .AND. !( Right( cDir, 1 ) == hb_ps() )
cDir += hb_ps()
ENDIF
RETURN cDir
STATIC FUNCTION DirDelPathSep( cDir )
IF Empty( hb_osDriveSeparator() )
DO WHILE Len( cDir ) > 1 .AND. Right( cDir, 1 ) == hb_ps()
cDir := hb_StrShrink( cDir, 1 )
ENDDO
ELSE
DO WHILE Len( cDir ) > 1 .AND. Right( cDir, 1 ) == hb_ps() .AND. ;
!( Right( cDir, 2 ) == hb_osDriveSeparator() + hb_ps() )
cDir := hb_StrShrink( cDir, 1 )
ENDDO
ENDIF
RETURN cDir
/*----------------------------------------------------------------------*/
FUNCTION hbide_fetchSubPaths( aPaths, cRootPath, lSubs )
LOCAL aDir, a_
@@ -1660,7 +1595,7 @@ FUNCTION hbide_stripRoot( cRoot, cPath )
FUNCTION hbide_syncRoot( cRoot, cPath )
LOCAL cPth, cFile, cExt
LOCAL cPathProc := hbide_PathMakeAbsolute( cRoot, cPath )
LOCAL cPathProc := hb_PathJoin( cPath, cRoot )
hb_fNameSplit( cPath, @cPth, @cFile, @cExt )
@@ -1793,16 +1728,6 @@ FUNCTION hbide_imageForFileType( cType )
ENDSWITCH
RETURN NIL
/*----------------------------------------------------------------------*/
/* Borrowed from hbmk2.prg - thanks Viktor */
FUNCTION FNameExtSet( cFileName, cExt )
LOCAL cDir, cName
hb_FNameSplit( cFileName, @cDir, @cName )
RETURN hb_FNameMerge( cDir, cName, cExt )
/*----------------------------------------------------------------------*/
FUNCTION hbide_array2string( a_, cDlm )

View File

@@ -1615,9 +1615,9 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess )
ENDIF
IF hb_isObject( ::cargo )
cExe := hbide_PathMakeAbsolute( cExe, hbide_pathToOSPath( ::cargo:cPath ) )
cExe := hb_PathJoin( hbide_pathToOSPath( ::cargo:cPath ), cExe )
ELSE
cExe := hbide_PathMakeAbsolute( cExe, hbide_pathToOSPath( ::oProject:location ) )
cExe := hb_PathJoin( hbide_pathToOSPath( ::oProject:location ), cExe )
ENDIF
IF !empty( cExe )

View File

@@ -160,7 +160,7 @@ PROCEDURE _APPMAIN( cFile, ... )
ENDIF
cFile := HB_COMPILEBUF( hHeaders, hb_ProgName(), "-n2", "-w", "-es2", "-q0", ;
"-I" + FNameDirGet( cFile ), "-D" + "__HBSCRIPT__HBRUN", cFile )
"-I" + hb_FNameDir( cFile ), "-D" + "__HBSCRIPT__HBRUN", cFile )
IF cFile == NIL
ERRORLEVEL( 1 )
EXIT
@@ -180,13 +180,6 @@ PROCEDURE _APPMAIN( cFile, ... )
RETURN
STATIC FUNCTION FNameDirGet( cFileName )
LOCAL cDir
hb_FNameSplit( cFileName, @cDir )
RETURN cDir
STATIC FUNCTION hbrun_CoreHeaderFiles()
LOCAL hHeaders

View File

@@ -174,8 +174,8 @@ PROCEDURE Standalone( aParams, hProjectList )
IF ! lCustom
/* Find out which projects are in current dir, these will be our primary targets */
FOR EACH tmp IN hProjectList
tmp1 := hb_ps() + FNameDirGet( PathSepToSelf( tmp:__enumKey() ) )
IF tmp1 == Right( hb_pwd(), Len( tmp1 ) ) /* Not ultimate solution */
tmp1 := hb_ps() + hb_FNameDir( PathSepToSelf( tmp:__enumKey() ) )
IF tmp1 == Right( hb_cwd(), Len( tmp1 ) ) /* Not ultimate solution */
hProjectReqList[ tmp:__enumKey() ] := tmp:__enumKey()
s_cReBase := SubStr( tmp1, 2 )
ENDIF
@@ -305,7 +305,7 @@ PROCEDURE GNUMake( aParams, hProjectList )
FOR EACH cProject IN aFilter
FOR EACH tmp IN hProjectList
IF hb_FileMatch( PathSepToSelf( cProject ), PathSepToSelf( tmp:__enumKey() ) ) .OR. ;
hb_FileMatch( PathSepToSelf( cProject ), DirDelPathSep( FNameDirGet( PathSepToSelf( tmp:__enumKey() ) ) ) )
hb_FileMatch( PathSepToSelf( cProject ), hb_DirSepDel( hb_FNameDir( PathSepToSelf( tmp:__enumKey() ) ) ) )
IF lFilterNegative
IF tmp:__enumKey() $ hProjectReqList
hb_HDel( hProjectReqList, tmp:__enumKey() )
@@ -433,7 +433,7 @@ STATIC PROCEDURE build_projects( nAction, hProjectList, hProjectReqList, cOption
IF ( nErrorLevel := call_hbmk2( cProjectPath, iif( lPrimary .OR. lContainer, iif( lContainer, cOptions, cOptions + cOptionsUser ), " -inc" ) +;
iif( ( lPrimary .OR. lContainer ) .AND. ;
hProjectList[ cProject ][ "cType" ] $ "hblib|hbdyn" .AND. ;
GetEnv( "HB_REBUILD_EXTERN" ) == "yes", " -hbx=" + FNameExtSet( cProjectPath, ".hbx" ), "" ), NIL ) ) == 0
GetEnv( "HB_REBUILD_EXTERN" ) == "yes", " -hbx=" + hb_FNameExtSet( cProjectPath, ".hbx" ), "" ), NIL ) ) == 0
/* Build dynamic lib */
IF GetEnv( "HB_BUILD_CONTRIB_DYN" ) == "yes" .AND. hProjectList[ cProject ][ "cType" ] == "hblib"
@@ -454,7 +454,7 @@ STATIC PROCEDURE build_projects( nAction, hProjectList, hProjectReqList, cOption
/* Compile documentation */
IF lInstall
mk_hbd( FNameDirGet( PathSepToSelf( cProjectPath ) ) )
mk_hbd( hb_FNameDir( PathSepToSelf( cProjectPath ) ) )
ENDIF
ENDIF
ELSE
@@ -500,7 +500,7 @@ STATIC FUNCTION call_hbmk2_hbinfo( cProjectPath, hProject )
ENDIF
#endif
AAdd( hProject[ "aDept" ], { "nDepth" => Len( tmp ) - Len( LTrim( tmp ) ),;
"cFileName_HBP" => StrTran( PathNormalize( PathMakeAbsolute( FNameExtSet( PathSepToSelf( LTrim( tmp ) ), ".hbp" ), s_cRebase ) ), "\", "/" ) } )
"cFileName_HBP" => StrTran( hb_PathNormalize( hb_PathJoin( s_cRebase, hb_FNameExtSet( PathSepToSelf( LTrim( tmp ) ), ".hbp" ) ) ), "\", "/" ) } )
ENDIF
NEXT
ENDIF
@@ -543,8 +543,8 @@ STATIC FUNCTION call_hbmk2( cProjectPath, cOptionsPre, cDynSuffix, cStdErr, cStd
hb_setenv( "_HB_DYNSUFF", cDynSuffix ) /* Request dll version of Harbour contrib dependencies (the implibs) to be linked (experimental) */
hb_setenv( "_HB_BUILD_LIBDYN", "yes" )
IF hb_FileExists( FNameExtSet( cProjectPath, ".hbc" ) )
cOptionsLibDyn += " " + FNameExtSet( cProjectPath, ".hbc" )
IF hb_FileExists( hb_FNameExtSet( cProjectPath, ".hbc" ) )
cOptionsLibDyn += " " + hb_FNameExtSet( cProjectPath, ".hbc" )
ENDIF
ELSE
hb_setenv( "_HB_DYNSUFF" )
@@ -615,34 +615,10 @@ STATIC FUNCTION mk_hbd( cDir )
STATIC FUNCTION AScanL( aArray, cString )
RETURN AScan( aArray, {| tmp | Lower( tmp ) == cString } )
STATIC FUNCTION FNameDirGet( cFileName )
LOCAL cDir
hb_FNameSplit( cFileName, @cDir )
RETURN cDir
STATIC FUNCTION FNameExtSet( cFileName, cExt )
LOCAL cDir, cName
hb_FNameSplit( cFileName, @cDir, @cName )
RETURN hb_FNameMerge( cDir, cName, cExt )
STATIC FUNCTION FNameExtDef( cFileName, cDefExt )
LOCAL cDir, cName, cExt
hb_FNameSplit( cFileName, @cDir, @cName, @cExt )
IF Empty( cExt )
cExt := cDefExt
ENDIF
RETURN hb_FNameMerge( cDir, cName, cExt )
STATIC FUNCTION DirGetName( cDir )
LOCAL cName
cDir := DirDelPathSep( cDir )
cDir := hb_DirSepDel( cDir )
hb_FNameSplit( cDir,, @cName )
@@ -652,97 +628,9 @@ STATIC FUNCTION DirGetName( cDir )
RETURN cName
STATIC FUNCTION DirAddPathSep( cDir )
IF ! Empty( cDir ) .AND. !( Right( cDir, 1 ) == hb_ps() )
cDir += hb_ps()
ENDIF
RETURN cDir
STATIC FUNCTION DirDelPathSep( cDir )
IF Empty( hb_osDriveSeparator() )
DO WHILE Len( cDir ) > 1 .AND. Right( cDir, 1 ) == hb_ps()
cDir := hb_StrShrink( cDir, 1 )
ENDDO
ELSE
DO WHILE Len( cDir ) > 1 .AND. Right( cDir, 1 ) == hb_ps() .AND. ;
!( Right( cDir, 2 ) == hb_osDriveSeparator() + hb_ps() )
cDir := hb_StrShrink( cDir, 1 )
ENDDO
ENDIF
RETURN cDir
STATIC FUNCTION PathSepToSelf( cFileName )
RETURN StrTran( cFileName, iif( hb_ps() == "\", "/", "\" ), hb_ps() )
STATIC FUNCTION hb_pwd()
RETURN DirAddPathSep( hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir() )
STATIC FUNCTION PathMakeAbsolute( cPathR, cPathA )
LOCAL cDirA
LOCAL cDirR, cDriveR, cNameR, cExtR
IF Empty( cPathA )
RETURN cPathR
ENDIF
hb_FNameSplit( cPathR, @cDirR, @cNameR, @cExtR, @cDriveR )
IF ! Empty( cDriveR ) .OR. ( ! Empty( cDirR ) .AND. Left( cDirR, 1 ) $ hb_osPathDelimiters() )
RETURN cPathR
ENDIF
hb_FNameSplit( cPathA, @cDirA )
IF Empty( cDirA )
RETURN cPathR
ENDIF
RETURN hb_FNameMerge( cDirA + cDirR, cNameR, cExtR )
#define _ISDRIVESPEC( cDir ) ( ! Empty( hb_osDriveSeparator() ) .AND. Right( cDir, Len( hb_osDriveSeparator() ) ) == hb_osDriveSeparator() )
/* NOTE: Can hurt if there are symlinks on the way. */
STATIC FUNCTION PathNormalize( cPath )
LOCAL aDir
LOCAL cDir
IF ! Empty( cPath )
aDir := hb_ATokens( cPath, hb_ps() )
FOR EACH cDir IN aDir DESCEND
IF cDir == "."
hb_ADel( aDir, cDir:__enumIndex(), .T. )
ELSEIF !( cDir == ".." ) .AND. ;
! Empty( cDir ) .AND. ;
! _ISDRIVESPEC( cDir )
IF cDir:__enumIndex() < Len( cDir:__enumBase() ) .AND. ;
aDir[ cDir:__enumIndex() + 1 ] == ".."
hb_ADel( aDir, cDir:__enumIndex() + 1, .T. )
hb_ADel( aDir, cDir:__enumIndex(), .T. )
ENDIF
ENDIF
NEXT
cPath := ""
FOR EACH cDir IN aDir
cPath += cDir
IF cDir:__enumIndex() < Len( cDir:__enumBase() )
cPath += hb_ps()
ENDIF
NEXT
IF Empty( cPath )
cPath := "." + hb_ps()
ENDIF
ENDIF
RETURN cPath
/* Convert indented list of line to tree / list of parent-child pairs */
STATIC PROCEDURE DeptLinesToDeptPairList( aPairList, cParent, aFlatTree )
LOCAL hFlatTreeElement

View File

@@ -513,6 +513,14 @@ REQUEST HB_HKEYS
REQUEST HB_FGETATTR
REQUEST HB_FSETATTR
REQUEST HB_DIRBUILD
REQUEST HB_FNAMENAME
REQUEST HB_FNAMEDIR
REQUEST HB_FNAMEEXTSET
REQUEST HB_DIRSEPADD
REQUEST HB_DIRSEPDEL
REQUEST HB_PATHJOIN
/* For hbrun emulation */
STATIC s_cDirBase_hbrun
STATIC s_cProgName_hbrun
@@ -9815,9 +9823,6 @@ STATIC FUNCTION ArchCompFilter( hbmk, cItem )
RETURN cItem
STATIC FUNCTION hb_cwd()
RETURN DirAddPathSep( hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir() )
STATIC FUNCTION MacroProc( hbmk, cString, cFileName, cMacroPrefix )
LOCAL nStart
LOCAL nEnd