mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Windows import autoscanner fixes
This commit is contained in:
parent
558fb2f789
commit
83022db8cb
@ -323,12 +323,19 @@ void MainWindow::on_action_Import_Data_triggered()
|
|||||||
|
|
||||||
QList<QString> AutoScannerPaths =
|
QList<QString> AutoScannerPaths =
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
// Apple OSX mount points
|
||||||
{ "/Volumes" };
|
{ "/Volumes" };
|
||||||
|
|
||||||
#elif Q_OS_WIN
|
#elif Q_OS_WIN
|
||||||
{ "dummy" };
|
// This is a dummy on windows, as we are scanning drive letters
|
||||||
// scan all available drive letters after C:
|
{ QString() };
|
||||||
#else
|
|
||||||
{ "/Media", "/mnt" };
|
#else // UNIX
|
||||||
|
// Mountpoints for Linux, UNIX, BSD, etc.
|
||||||
|
{ "/media", "/mnt", "/Media" };
|
||||||
|
|
||||||
|
// TODO: Extra code will need to go here for user directory fuser mounts and similar
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QHash<QString,QString> datacard;
|
QHash<QString,QString> datacard;
|
||||||
@ -342,6 +349,7 @@ void MainWindow::on_action_Import_Data_triggered()
|
|||||||
qDebug() << "Scanning" << path;
|
qDebug() << "Scanning" << path;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
// Get available drive letters
|
||||||
QFileInfoList list = QDir::drives();
|
QFileInfoList list = QDir::drives();
|
||||||
#else
|
#else
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
@ -351,17 +359,22 @@ void MainWindow::on_action_Import_Data_triggered()
|
|||||||
|
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
QFileInfo fileInfo = list.at(i);
|
QFileInfo fileInfo = list.at(i);
|
||||||
QString p=fileInfo.fileName();
|
|
||||||
|
|
||||||
|
// Scan through available machine loaders and test if this folder contains valid folder structure
|
||||||
Q_FOREACH(MachineLoader * loader, loaders) {
|
Q_FOREACH(MachineLoader * loader, loaders) {
|
||||||
QString scanpath=path+"/"+p;
|
QString scanpath;
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
scanpath = path + "/";
|
||||||
|
#endif
|
||||||
|
scanpath += fileInfo.fileName();
|
||||||
|
|
||||||
if (loader->Detect(scanpath)) {
|
if (loader->Detect(scanpath)) {
|
||||||
datacard[loader->ClassName()]=scanpath;
|
datacard[loader->ClassName()]=scanpath;
|
||||||
|
|
||||||
qDebug() << "Found" << loader->ClassName() << "datacard at" << scanpath;
|
qDebug() << "Found" << loader->ClassName() << "datacard at" << scanpath;
|
||||||
if (datacard_path.isEmpty()) {
|
if (datacard_path.isEmpty()) {
|
||||||
datacard_loader=loader;
|
datacard_loader = loader;
|
||||||
datacard_path=scanpath;
|
datacard_path = scanpath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user