This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Qt5: QDir::mkpath() fails for /cygdrive/ paths


On 09/07/2015 20:14, David Stacey wrote:
QDir::mkpath() fails when creating paths that start '/cygdrive/'. This problem is only shown with Qt5 (not Qt4), and only with paths that start '/cygdrive/' (so running from my home directory '~' is fine). This is not a permissions problem, as it works fine with Qt4.

Sample programme is below. Compile for Qt5 as per the comments. 'cd /cygdrive/X' where X is a local drive where you have permissions to create a directory. Run './create_directory new_dir' and it fails to create the directory. Programme works fine when compiled with Qt4.

I have updated to libQt5Core5-5.4.2-2, and I'm still getting this problem. Is anyone else able to reproduce this, or offer some insight as to why it might be failing? For completeness, my example programme is included below.

Dave.


// Programme to create a directory.
// Works with Qt4:
// g++ -I/usr/include/qt4 -o create_directory create_directory.cpp -lQtCore
//
// Fails with Qt5 if run from a path starting '/cygdrive/', otherwise OK:
// g++ -I/usr/include/qt5 -o create_directory create_directory.cpp -lQt5Core

#include <QtCore/QDir>
#include <iostream>

int main(int argc, char** argv)
{
  if (argc != 2)
    std::cerr << "Syntax: create_directory <name>";
  else
  {
    QDir dir(QDir::currentPath());
    if (!dir.mkpath(argv[1]))
      std::cerr << "Failed to create directory '"
                << argv[1] << "'." << std::endl;
  }
  return 0;
}




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]