Changeset 363 for trunk/qmake
- Timestamp:
- Nov 30, 2009, 6:52:30 PM (16 years ago)
- Location:
- trunk/qmake
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qmake/cachekeys.h
r362 r363 48 48 #include <qfile.h> 49 49 #include <qfileinfo.h> 50 #include <qdir.h>51 50 #include <qhash.h> 52 51 … … 108 107 return true; 109 108 110 #ifdef Q_OS_OS2111 return QDir::isRelativePath(file);112 #else113 109 const QChar c0 = file.at(0); 114 110 const QChar c1 = length >= 2 ? file.at(1) : QChar(0); … … 118 114 || (c0 == QLatin1Char('/') && c1 == QLatin1Char('/')) 119 115 || (c0 == QLatin1Char('\\') && c1 == QLatin1Char('\\'))); 120 #endif121 116 } 122 117 }; -
trunk/qmake/generators/makefile.cpp
r362 r363 125 125 } 126 126 bool ret = true; 127 #if defined(Q_OS_WIN) 127 #if defined(Q_OS_WIN) 128 128 bool driveExists = true; 129 129 if(!QDir::isRelativePath(path)) { … … 138 138 } 139 139 if(driveExists) 140 #elif defined(Q_OS_OS2)141 path = QFileInfo(path).absoluteFilePath();142 QString drv = path.left(3);143 if (!QFile::exists(drv))144 warn_msg(WarnLogic, "Cannot access drive '%s' (%s)",145 drv.toLocal8Bit().data(), path.toLocal8Bit().data());146 else147 140 #endif 148 141 { … … 348 341 vpath += Option::output_dir; 349 342 } 350 foreach(const QString &vp, vpath) { 351 QString real_val = QDir(vp).absoluteFilePath(val); 352 if (exists(real_val)) { 353 val = real_val; 343 for(QStringList::Iterator vpath_it = vpath.begin(); 344 vpath_it != vpath.end(); ++vpath_it) { 345 QString real_dir = Option::fixPathToLocalOS((*vpath_it)); 346 if(exists(real_dir + QDir::separator() + val)) { 347 QString dir = (*vpath_it); 348 if(dir.right(Option::dir_sep.length()) != Option::dir_sep) 349 dir += Option::dir_sep; 350 val = dir + val; 354 351 if(!(flags & VPATH_NoFixify)) 355 352 val = fileFixify(val); … … 853 850 file = libinfo.first("QMAKE_PRL_TARGET"); 854 851 if(QDir::isRelativePath(file)) 855 file = QDir(dir).absoluteFilePath(file);852 file); 856 853 } 857 854 } … … 2737 2734 } 2738 2735 2739 inline static bool pathEquals(const QString &path1, const QString &path2)2740 {2741 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)2742 return path1.compare(path2, Qt::CaseInsensitive) == 0;2743 #else2744 return path1 == path2;2745 #endif2746 }2747 2748 inline static bool pathStartsWith(const QString &path1, const QString &path2)2749 {2750 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)2751 return path1.toLower().startsWith(path2.toLower());2752 #else2753 return path1.startsWith(path2);2754 #endif2755 }2756 2757 2736 QString 2758 2737 MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const QString &in_d, … … 2785 2764 if(fix == FileFixifyAbsolute || (fix == FileFixifyDefault && project->isActiveConfig("no_fixpath"))) { 2786 2765 if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) //already absolute 2787 ret = QDir(pwd).absoluteFilePath(ret);2766 ret); 2788 2767 ret = Option::fixPathToTargetOS(ret, false, canon); 2789 2768 } else { //fix it.. … … 2803 2782 if(out_dir != in_dir || !qfileinfo.isRelative()) { 2804 2783 if(qfileinfo.isRelative()) { 2805 ret = QDir(in_dir).absoluteFilePath(qfile);2784 ret = ; 2806 2785 qfileinfo.setFile(ret); 2807 2786 } 2808 2787 ret = Option::fixPathToTargetOS(ret, false, canon); 2809 2788 if(canon && qfileinfo.exists() && 2810 pathEquals(file, Option::fixPathToTargetOS(ret, true, canon)))2789 )) 2811 2790 ret = Option::fixPathToTargetOS(qfileinfo.canonicalFilePath()); 2812 2791 QString match_dir = Option::fixPathToTargetOS(out_dir, false, canon); 2813 if( pathEquals(ret, match_dir)) {2792 if() { 2814 2793 ret = ""; 2815 } else if( pathStartsWith(ret,match_dir + Option::dir_sep)) {2794 } else if(match_dir + Option::dir_sep)) { 2816 2795 ret = ret.mid(match_dir.length() + Option::dir_sep.length()); 2817 2796 } else { … … 2834 2813 if(match_dir.isEmpty()) 2835 2814 break; 2836 if( pathStartsWith(ret,match_dir + Option::dir_sep)) {2815 if(match_dir + Option::dir_sep)) { 2837 2816 //concat 2838 2817 int remlen = ret.length() - (match_dir.length() + 1); … … 3025 3004 if(!file.fileName().isEmpty()) { 3026 3005 if(QDir::isRelativePath(file.fileName())) 3027 file.setFileName( QDir(Option::output_dir).absoluteFilePath(file.fileName())); //pwd when qmake was run3006 file.setFileName()); //pwd when qmake was run 3028 3007 QFileInfo fi(fileInfo(file.fileName())); 3029 3008 if(fi.isDir()) … … 3038 3017 } 3039 3018 if(QDir::isRelativePath(file.fileName())) { 3040 file.setFileName(QDir(Option::output_dir).absoluteFilePath(file.fileName())); //pwd when qmake was run 3019 QString fname = Option::output_dir; //pwd when qmake was run 3020 if(!fname.endsWith("/")) 3021 fname += "/"; 3022 fname += file.fileName(); 3023 file.setFileName(fname); 3041 3024 } 3042 3025 if(!build.isEmpty())