int FuseOpenTest::OpenFileAllowError(const char *filename, int flags) { auto fs = TestFS(); auto realpath = fs->mountDir() / filename; int fd = ::open(realpath.c_str(), flags); if (fd >= 0) { return fd; } else { return -errno; } }
void HardDiskDialog::SetupTransferPcPane() { QListWidgetItem* item = ui->driveList->selectedItems().at(0); QString mountpoint; QString dev = item->text().mid(item->text().indexOf("(") + 1, item->text().indexOf(")") - item->text().indexOf("(") - 1); //qDebug() << "Mounting " + dev; if (udisks->blockDevice(dev)->fileSystem()->mountPoints().count() == 0) { mountpoint = udisks->blockDevice(dev)->fileSystem()->mount(); } else { mountpoint = udisks->blockDevice(dev)->fileSystem()->mountPoints().at(0); } if (mountpoint == "") { QMessageBox::critical(this, "Couldn't mount", "Couldn't mount " + dev + ".", QMessageBox::Ok, QMessageBox::Ok); return; } QDir mountDir(mountpoint); if (mountDir.cd("theOSTransferData")) { ui->TransferList->clear(); ui->DataNotFoundFrame->setVisible(false); for (QString file : mountDir.entryList()) { //Get Directories if (file == "." || file == "..") { continue; } if (QDir(mountDir.path() + "/" + file).exists()) { QListWidgetItem *item = new QListWidgetItem(file); item->setIcon(QIcon::fromTheme("computer")); ui->TransferList->addItem(item); } } AllTransfersDir = mountDir; } else { ui->DataNotFoundFrame->setVisible(true); } ui->forwardButton->setEnabled(false); }