summaryrefslogtreecommitdiff
path: root/qmake/main.cpp
Unidiff
Diffstat (limited to 'qmake/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/main.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qmake/main.cpp b/qmake/main.cpp
index eed1697..cc2d08a 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -39,50 +39,55 @@
39#include "option.h" 39#include "option.h"
40#include "makefile.h" 40#include "makefile.h"
41#include <qnamespace.h> 41#include <qnamespace.h>
42#include <qregexp.h> 42#include <qregexp.h>
43#include <qdir.h> 43#include <qdir.h>
44#include <stdio.h> 44#include <stdio.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#include <ctype.h> 46#include <ctype.h>
47#include <fcntl.h> 47#include <fcntl.h>
48#include <sys/types.h> 48#include <sys/types.h>
49#include <sys/stat.h> 49#include <sys/stat.h>
50 50
51// for Borland, main is defined to qMain which breaks qmake 51// for Borland, main is defined to qMain which breaks qmake
52#undef main 52#undef main
53 53
54int main(int argc, char **argv) 54int main(int argc, char **argv)
55{ 55{
56 /* parse command line */ 56 /* parse command line */
57 if(!Option::parseCommandLine(argc, argv)) 57 if(!Option::parseCommandLine(argc, argv))
58 return 666; 58 return 666;
59 59
60 QDir sunworkshop42workaround = QDir::current(); 60 QDir sunworkshop42workaround = QDir::current();
61 QString oldpwd = sunworkshop42workaround.currentDirPath(); 61 QString oldpwd = sunworkshop42workaround.currentDirPath();
62 Option::output_dir = oldpwd; //for now this is the output dir 62 Option::output_dir = oldpwd; //for now this is the output dir
63 if(Option::output_dir.right(1) != QString(QChar(QDir::separator()))) 63#ifdef Q_WS_WIN
64 Option::output_dir += QDir::separator(); 64 if ( !(Option::output_dir.length() == 3 && Option::output_dir[0].isLetter() && Option::output_dir.endsWith(":/") ) )
65#endif
66 {
67 if(Option::output_dir.right(1) != QString(QChar(QDir::separator())))
68 Option::output_dir += QDir::separator();
69 }
65 QMakeProject proj; 70 QMakeProject proj;
66 int exit_val = 0; 71 int exit_val = 0;
67 QStringList files; 72 QStringList files;
68 if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) 73 if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
69 files << "(*hack*)"; //we don't even use files, but we do the for() body once 74 files << "(*hack*)"; //we don't even use files, but we do the for() body once
70 else 75 else
71 files = Option::mkfile::project_files; 76 files = Option::mkfile::project_files;
72 for(QStringList::Iterator pfile = files.begin(); pfile != files.end(); pfile++) { 77 for(QStringList::Iterator pfile = files.begin(); pfile != files.end(); pfile++) {
73 if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || 78 if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
74 Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { 79 Option::qmake_mode == Option::QMAKE_GENERATE_PRL) {
75 QString fn = (*pfile); 80 QString fn = (*pfile);
76 81
77 //setup pwd properly 82 //setup pwd properly
78 debug_msg(1, "Resetting dir to: %s", oldpwd.latin1()); 83 debug_msg(1, "Resetting dir to: %s", oldpwd.latin1());
79 QDir::setCurrent(oldpwd); //reset the old pwd 84 QDir::setCurrent(oldpwd); //reset the old pwd
80 int di = fn.findRev(Option::dir_sep); 85 int di = fn.findRev(Option::dir_sep);
81 if(di != -1) { 86 if(di != -1) {
82 debug_msg(1, "Changing dir to: %s", fn.left(di).latin1()); 87 debug_msg(1, "Changing dir to: %s", fn.left(di).latin1());
83 if(!QDir::setCurrent(fn.left(fn.findRev(Option::dir_sep)))) 88 if(!QDir::setCurrent(fn.left(fn.findRev(Option::dir_sep))))
84 fprintf(stderr, "Cannot find directory: %s\n", fn.left(di).latin1()); 89 fprintf(stderr, "Cannot find directory: %s\n", fn.left(di).latin1());
85 fn = fn.right(fn.length() - di - 1); 90 fn = fn.right(fn.length() - di - 1);
86 } 91 }
87 92
88 /* read project.. */ 93 /* read project.. */