2

I'm requesting the user to select a folder with QFileDialog:

QString directory = QFileDialog::getExistingDirectory(this,"Caption","",
                    QFileDialog::ShowDirsOnly);

I want the user to be able to select ALL folders, however C:/Windows/System32/spool/ cannot be found with the QFileDialog and i suspect there might be others.

I have tried setting the flag QFileDialog::HideNameFilterDetails in order to view hidden files, however this does not do the trick.

Is there a solution to this problem?

C:/Windows/System 32/spool does not exist in QFileDialog

enter image description here

Nicolai Lissau
  • 7,298
  • 5
  • 43
  • 57

2 Answers2

1

This appears to be a problem when you're running a 32-bit application on 64-bit Windows. You should be able to see the spool folder if you compile your application with the native x64 compiler. Worst case, you can write a simple 64-bit native app for showing the folder browser and have the 32-bit app run and communicate with the 64-bit app to get the results.

I was hoping that disabling the WOW64 File System Redirector would be enough, but it didn't help. According to this answer, it may work if you use Wow64DisableWow64FsRedirection to disable redirection on all the threads in the process but this approach is not recommended even by the person who answered the question.

Community
  • 1
  • 1
deGoot
  • 996
  • 4
  • 11
  • I'm not sure whether my client is a 32 og 64 bit machine, but i'm guessing 32. So you are saying that if i compile for 32 bit, i can see the folder in 32 bit right? I'm not too fund about making those kind of hacks, i'd rather find a workaround such as the ride-along 64 app. Thank you for your answer – Nicolai Lissau Mar 29 '14 at 12:08
  • If your Windows OS is 64-bit, but your application is 32-bit, then this folder does not show up. If you build your application to be a 64-bit, you can see the folder just fine. – deGoot Mar 29 '14 at 13:37
0

You can't use that static function to see all folders. QFileDialog is doing some additional filtering behind the scenes, and that this filtering cannot be turned off in any obvious way using static function getExistingDirectory.

You can see all folders including the hidden ones by:

QFileDialog fd;
fd.setFilter(QDir::Hidden);
fd.setFileMode(QFileDialog::Directory);
fd.exec();
QString directory = fd.directory().path();
Nejat
  • 31,784
  • 12
  • 106
  • 138