I want to use isWritable()
from QFileInfo. According to the docs, you have to somehow set qt_ntfs_permission_lookup
to 1 to get a meaningful result on Windows. The C++ code for this is
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
qt_ntfs_permission_lookup++; // turn checking on
qt_ntfs_permission_lookup--; // turn it off again
How do I "translate" the extern statement into Python?
One possible solution is to create functions that change the state of that variable in C++ and export it to python. To export a C++ function to python there are options like pybind11, SWIG, sip, shiboken2, etc.
In this case, implement a small library using pybind11
and you can install it by following these steps:
Requirements:
Also with the help of github actions I have created the wheels for some versions of Qt and python so download it from here, extract the .whl and run:
Then you run it as: