EgtGeneral 1.6j1 :
- aggiunte funzioni per dividere path in file e directories.
This commit is contained in:
@@ -125,6 +125,32 @@ FindFirstFileEgt( const string& sFileSpec, string& sFileName)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
GetFileName( const string& sPath)
|
||||
{
|
||||
// cerco l'ultimo separatore
|
||||
size_t iPos = sPath.find_last_of( "/\\") ;
|
||||
// se non c'è, è solo il nome di un file
|
||||
if ( iPos == string::npos)
|
||||
return sPath ;
|
||||
// ritorno la parte finale
|
||||
return sPath.substr( iPos+1) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
GetDirectory( const string& sPath)
|
||||
{
|
||||
// cerco l'ultimo separatore
|
||||
size_t iPos = sPath.find_last_of( "/\\") ;
|
||||
// se non c'è, è solo il nome di un file
|
||||
if ( iPos == string::npos)
|
||||
return "" ;
|
||||
// ritorno la parte iniziale
|
||||
return sPath.substr( 0, iPos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExistsDirectory( const string& sDir)
|
||||
|
||||
Reference in New Issue
Block a user