get rid of lyxlib.h:chmod.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22126 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-13 11:24:10 +00:00
parent 4752cc8d61
commit 2e34b2876a
4 changed files with 8 additions and 6 deletions

View File

@ -169,7 +169,7 @@ void ConverterCache::Impl::writeIndex()
FileName const index(addName(cache_dir.absFilename(), "index"));
ofstream os(index.toFilesystemEncoding().c_str());
os.close();
if (!chmod(index, 0600))
if (!index.changePermission(0600))
return;
os.open(index.toFilesystemEncoding().c_str());
CacheType::iterator it1 = cache.begin();

View File

@ -157,10 +157,13 @@ bool FileName::changePermission(unsigned long int mode) const
return false;
}
if (!chmod(*this, mode)) {
LYXERR0("File " << *this << " cannot be changed to " << mode << " mode!");
#if defined (HAVE_CHMOD) && defined (HAVE_MODE_T)
if (::chmod(file.toFilesystemEncoding().c_str(), mode_t(mode)) != 0) {
LYXERR0("File " << *this << ": cannot change permission to "
<< mode << ".");
return false;
}
#endif
return true;
}

View File

@ -27,7 +27,7 @@ using namespace std;
namespace lyx {
namespace support {
bool chmod(FileName const & file, unsigned long int mode)
static bool chmod(FileName const & file, unsigned long int mode)
{
#if defined (HAVE_CHMOD) && defined (HAVE_MODE_T)
if (::chmod(file.toFilesystemEncoding().c_str(), mode_t(mode)) != 0)

View File

@ -25,8 +25,7 @@ namespace support {
/// get the current working directory
FileName const getcwd();
/// Change file permissions
bool chmod(FileName const & file, unsigned long int mode);
/**
* rename a file, returns false if it fails.
* It can handle renames across partitions.