delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/07/09/15:15:20

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=Vf6
AtMITFUJ4EBZMkxl+W73DM2lj2cNq6vEKeMv9LDaF6ZwYLvNIhaU6nCfW7qTpKoU
b3HfWZFZm1K+vCi9DeCliSej4iWe/YW+rBXOwAb1dfdJtAsXSNjRAPTeelS570R+
DaDlTvHzmaWcEDLuqM9vYMSYiuNyCffBvwThTIFA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; s=default; bh=ZDECIufq1
sld0pcqOd87TSEn3Ik=; b=R1IOuq9IIhQuRxJx1a3+CpOgoffbZnqXLP0aAa6Ky
C5kUUmn3Ocy/QZwdJADoUDAwJrhJSn9KoQ1Yiec/RvhrEtaZJWq1JX7xnMIsQgVy
NwAFC5vpnQrtYRhTumBPrFXFa7TS6FtxsIneYh9JBp418Mtj85pq0n/aDdf6vyMX
oU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_COUK,SPF_PASS autolearn=no version=3.3.2
X-HELO: out.ipsmtp2nec.opaltelecom.net
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A2C6AQCIx55V/z9X0lUNTodmuGWHDQOCLwEBAQEBAYVYFUA2AgUWCwILAwIBAgFYCAEBwFJwllaBIY9NglKBQwWMKoUbgmikZ4QigzkBAQE
X-IPAS-Result: A2C6AQCIx55V/z9X0lUNTodmuGWHDQOCLwEBAQEBAYVYFUA2AgUWCwILAwIBAgFYCAEBwFJwllaBIY9NglKBQwWMKoUbgmikZ4QigzkBAQE
To: cygwin AT cygwin DOT com
From: David Stacey <drstacey AT tiscali DOT co DOT uk>
Subject: Qt5: QDir::mkpath() fails for /cygdrive/ paths
Message-ID: <559EC831.9030404@tiscali.co.uk>
Date: Thu, 9 Jul 2015 20:14:57 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1
MIME-Version: 1.0
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019