Mailinglist Archive: yast-devel (101 mails)

< Previous Next >
[yast-devel] New FileUtils functions (a new-year present for YCP users)
  • From: Katarina Machalkova <kmachalkova@xxxxxxx>
  • Date: Thu, 7 Jan 2010 15:11:44 +0100
  • Message-id: <201001071511.50114.kmachalkova@xxxxxxx>
Look what the three wise men from the east have brought us: new functions for
file handling (most of them are self-explanatory):

// user:group, file name, true for directories
FileUtils::Chown ( "nobody:nogroup", "/tmp", recursively)

// access rights, file name, true for directories
FileUtils::Chmod ("go-rwx", "/etc/passwd", recursively)

// file name template, user:group, access rights
FileUtils::MkTempFile ( "/tmp/tmpfile.XXXX", "somebody:somegroup", "744")

// dir name template, user:group, access rights
FileUtils::MkTempDirectory ( "/tmp/tmpdir.XXXX", "nobody:nogroup", "go+x")

If you use one of the mktemp functions, do not forget to call
FileUtils::CleanupTemp() somewhere in the cleanup routines of your
module/client, in order to remove tmpfiles created by all previous calls to

For more details and examples, see FileUtils.ycp module


P.S. These were actually not the three wise men :) I've coded these routines
while working on YaST support for SLMS folks and they live in SlmsServerUtils
YCP module in internal git repo. I thought however they might be of general
interest, hence I copied them to FileUtils in yast2 base package

P.P.S If anyone would like to see these routines backported to code11 (SLE11
SP1, for example), let me know
\\\\\ Katarina Machalkova
\\\\\\\__o YaST developer
__\\\\\\\'/_ & hedgehog painter
< Previous Next >
This Thread
  • No further messages