本文整理汇总了C++中QDir::root方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::root方法的具体用法?C++ QDir::root怎么用?C++ QDir::root使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDir
的用法示例。
在下文中一共展示了QDir::root方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkDirectoryStructure
bool Config::checkDirectoryStructure(){
//Check for EasyPBI directory structure and create it if it is not there
if( !QDir(defaultSettings[1]).exists() ){
qDebug() << "Creating the EasyPBI directory in current user's home folder:" << defaultSettings[1];
QDir dir;
dir.root();
if( !dir.mkdir(defaultSettings[1]) ){ //Create the program directory
//Could not create the Program directory
qDebug() << " - Error with home directory permissions, could not create directory";
return FALSE;
}
}
if( !QDir(defaultSettings[3]).exists() ){
QDir dir;
dir.root();
if( !dir.mkdir(defaultSettings[3]) ){ //module directory
qDebug() << " - Error with directory permissions, could not create directory" << defaultSettings[3];
return FALSE;
}
}
if( !QDir(defaultSettings[2]).exists() ){
QDir dir;
dir.root();
if( !dir.mkdir(defaultSettings[2]) ){ // PBI output directory
qDebug() << " - Error with directory permissions, could not create directory" << defaultSettings[2];
return FALSE;
}
}
if( !QDir(defaultSettings[4]).exists() ){
QDir dir;
dir.root();
if( !dir.mkdir(defaultSettings[4]) ){ // pkg cache
qDebug() << " - Error with directory permissions, could not create directory" << defaultSettings[4];
return FALSE;
}
}
//Check for the defaulticons.png file
if( !QFile(defaultSettings[5]).exists() ){
//file does not exist, copy the included resource to the file
qDebug() << " - Copying the default icon to the EasyPBI directory";
QFile::copy(":/png/icons/defaulticon.png",defaultSettings[5]);
QFile::setPermissions(defaultSettings[5],QFile::ReadGroup | QFile::WriteGroup | QFile::ReadOwner | QFile::WriteOwner | QFile::ReadOther | QFile::WriteOther);
}
return TRUE;
}