mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 04:51:52 +00:00
Changed: Created and used isDirectoryWritable() function
This commit is contained in:
parent
d3a72f1506
commit
9721582940
4 changed files with 18 additions and 20 deletions
|
@ -118,16 +118,7 @@ void CInstallDialog::accept()
|
||||||
if (succeedsToWrite)
|
if (succeedsToWrite)
|
||||||
{
|
{
|
||||||
// check if directory is writable by current user
|
// check if directory is writable by current user
|
||||||
QFile file(m_dstDirectory + "/writable_test_for_ryzom_installer.txt");
|
if (!isDirectoryWritable(m_dstDirectory))
|
||||||
|
|
||||||
if (file.open(QFile::WriteOnly))
|
|
||||||
{
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
// remove it
|
|
||||||
file.remove();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
succeedsToWrite = false;
|
succeedsToWrite = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,16 +133,7 @@ void CMigrateDialog::accept()
|
||||||
if (succeedsToWrite)
|
if (succeedsToWrite)
|
||||||
{
|
{
|
||||||
// check if directory is writable by current user
|
// check if directory is writable by current user
|
||||||
QFile file(m_dstDirectory + "/writable_test_for_ryzom_installer.txt");
|
if (!isDirectoryWritable(m_dstDirectory))
|
||||||
|
|
||||||
if (file.open(QFile::WriteOnly))
|
|
||||||
{
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
// remove it
|
|
||||||
file.remove();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
succeedsToWrite = false;
|
succeedsToWrite = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,21 @@ bool isDirectoryEmpty(const QString &directory, bool recursize)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isDirectoryWritable(const QString &directory)
|
||||||
|
{
|
||||||
|
// check if directory is writable by current user
|
||||||
|
QFile file(directory + "/writable_test_for_ryzom_installer.txt");
|
||||||
|
|
||||||
|
if (!file.open(QFile::WriteOnly)) return false;
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
// remove it
|
||||||
|
file.remove();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
qint64 getDirectorySize(const QString &directory, bool recursize)
|
qint64 getDirectorySize(const QString &directory, bool recursize)
|
||||||
{
|
{
|
||||||
qint64 size = 0;
|
qint64 size = 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@ QString qBytesToHumanReadable(qint64 bytes);
|
||||||
QString nameToId(const QString &name);
|
QString nameToId(const QString &name);
|
||||||
|
|
||||||
bool isDirectoryEmpty(const QString &directory, bool recursize);
|
bool isDirectoryEmpty(const QString &directory, bool recursize);
|
||||||
|
bool isDirectoryWritable(const QString &directory);
|
||||||
|
|
||||||
qint64 getDirectorySize(const QString &directory, bool recursize);
|
qint64 getDirectorySize(const QString &directory, bool recursize);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue