Mailinglist Archive: zypp-devel (84 mails)
| < Previous | Next > |
[zypp-devel] New: ZYpp::getTarget and Target::assertRootPrefix
- From: Michael Andres <ma@xxxxxxx>
- Date: Fri, 15 Aug 2008 14:44:11 +0200
- Message-id: <20080815124410.GA7358@xxxxxxx>
JFYI: New methods
class ZYpp:
/** Same as \ref target but returns NULL if target is not
* initialized, instead of throwing.
*/
Target_Ptr zypp::getTarget() const;
class Target:
/** Return the path prefixed by the target root, unless
* it already is prefixed.
*/
Pathname Target::assertRootPrefix( const Pathname & path_r ) const
{ return Pathname::assertprefix( root(), path_r ); }
So if you have a
Pathname mypath;
and want to prefix it with the targets root, in case the target is already
initialized:
Target_Ptr target( getZYpp()->getTarget() );
if ( target )
mypath = target->assertRootPrefix( mypath );
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
class ZYpp:
/** Same as \ref target but returns NULL if target is not
* initialized, instead of throwing.
*/
Target_Ptr zypp::getTarget() const;
class Target:
/** Return the path prefixed by the target root, unless
* it already is prefixed.
*/
Pathname Target::assertRootPrefix( const Pathname & path_r ) const
{ return Pathname::assertprefix( root(), path_r ); }
So if you have a
Pathname mypath;
and want to prefix it with the targets root, in case the target is already
initialized:
Target_Ptr target( getZYpp()->getTarget() );
if ( target )
mypath = target->assertRootPrefix( mypath );
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |