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
FileUtils::MkTemp*
For more details and examples, see FileUtils.ycp module
fB.
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
signature.asc
Description: This is a digitally signed message part.
