public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Qt5: QDir::mkpath() fails for /cygdrive/ paths
@ 2015-07-09 19:15 David Stacey
  2015-08-12 21:59 ` David Stacey
  0 siblings, 1 reply; 4+ messages in thread
From: David Stacey @ 2015-07-09 19:15 UTC (permalink / raw)
  To: cygwin

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 am using libQt5Core5-5.4.1-4 and libQt4-4.8.7-1 under cygwin-2.0.4-1. 
I haven't had chance to try with Qt 5.4.2 (announced yesterday), so 
apologies in advance if this is fixed already.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-13 16:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 19:15 Qt5: QDir::mkpath() fails for /cygdrive/ paths David Stacey
2015-08-12 21:59 ` David Stacey
2015-08-12 23:50   ` Andrey Repin
2015-08-13 16:39   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).