From f9b94a7ee13e7b8a1c1482391d935a2d5a754848 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 15 Nov 2011 10:34:38 +0200 Subject: qmake: Normalize paths instead of converting to native separators Task-number: QTBUG-22738 Change-Id: I40163a883d84beff79f52bff141d61dfe921c129 Reviewed-by: Oswald Buddenhagen --- qmake/main.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'qmake/main.cpp') diff --git a/qmake/main.cpp b/qmake/main.cpp index 99015177b2..150e12bd3c 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -103,8 +103,8 @@ int runQMake(int argc, char **argv) if(!(oldpwd.length() == 3 && oldpwd[0].isLetter() && oldpwd.endsWith(":/"))) #endif { - if(oldpwd.right(1) != QString(QChar(QDir::separator()))) - oldpwd += QDir::separator(); + if(!oldpwd.endsWith(QLatin1Char('/'))) + oldpwd += QLatin1Char('/'); } Option::output_dir = oldpwd; //for now this is the output dir @@ -141,28 +141,33 @@ int runQMake(int argc, char **argv) for(QStringList::Iterator pfile = files.begin(); pfile != files.end(); pfile++) { if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { - QString fn = Option::fixPathToLocalOS((*pfile)); + QString fn = Option::normalizePath(*pfile); if(!QFile::exists(fn)) { - fprintf(stderr, "Cannot find file: %s.\n", fn.toLatin1().constData()); + fprintf(stderr, "Cannot find file: %s.\n", + QDir::toNativeSeparators(fn).toLatin1().constData()); exit_val = 2; continue; } //setup pwd properly - debug_msg(1, "Resetting dir to: %s", oldpwd.toLatin1().constData()); + debug_msg(1, "Resetting dir to: %s", + QDir::toNativeSeparators(oldpwd).toLatin1().constData()); qmake_setpwd(oldpwd); //reset the old pwd - int di = fn.lastIndexOf(QDir::separator()); + int di = fn.lastIndexOf(QLatin1Char('/')); if(di != -1) { - debug_msg(1, "Changing dir to: %s", fn.left(di).toLatin1().constData()); + debug_msg(1, "Changing dir to: %s", + QDir::toNativeSeparators(fn.left(di)).toLatin1().constData()); if(!qmake_setpwd(fn.left(di))) - fprintf(stderr, "Cannot find directory: %s\n", fn.left(di).toLatin1().constData()); + fprintf(stderr, "Cannot find directory: %s\n", + QDir::toNativeSeparators(fn.left(di)).toLatin1().constData()); fn = fn.right(fn.length() - di - 1); } // read project.. if(!project.read(fn)) { fprintf(stderr, "Error processing project file: %s\n", - fn == "-" ? "(stdin)" : (*pfile).toLatin1().constData()); + fn == QLatin1String("-") ? + "(stdin)" : QDir::toNativeSeparators(*pfile).toLatin1().constData()); exit_val = 3; continue; } @@ -179,7 +184,8 @@ int runQMake(int argc, char **argv) if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) fprintf(stderr, "Unable to generate project file.\n"); else - fprintf(stderr, "Unable to generate makefile for: %s\n", (*pfile).toLatin1().constData()); + fprintf(stderr, "Unable to generate makefile for: %s\n", + QDir::toNativeSeparators(*pfile).toLatin1().constData()); exit_val = 5; } delete mkfile; -- cgit v1.2.3