[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdevelop/parts/outputviews
From:       Jens Dagerbo <jens.dagerbo () swipnet ! se>
Date:       2003-04-28 13:06:32
[Download RAW message or body]

CVS commit by dagerbo: 

This just never ends, does it? Me and Julian put our heads together for this one, \
maybe we finally got the symlinked case working now.. My last fix needed Qt-3.1.2(!) \
to work, his didn't handle symlinked _files_. This, with code from Qt, hopefully \
covers all bases. 

No betting, please. ;)


  M +23 -3     makewidget.cpp   1.84


--- kdevelop/parts/outputviews/makewidget.cpp  #1.83:1.84
@@ -106,4 +106,26 @@ static const char *const message_xpm[] =
     };
 
+namespace
+{
+// code from qt-3.1.2 version of QDir::canonicalPath()
+QString canonicalPath( QString const & path )
+{
+    QString r;
+    char cur[PATH_MAX+1];
+    if ( ::getcwd( cur, PATH_MAX ) )
+    {
+        char tmp[PATH_MAX+1];
+        if( ::realpath( QFile::encodeName( path ), tmp ) )
+        {
+            r = QFile::decodeName( tmp );
+        }
+        //always make sure we go back to the current dir
+        ::chdir( cur );
+    }
+    return r;
+}
+
+}
+
 class SelectionPreserver
 {
@@ -428,7 +450,5 @@ QString MakeWidget::guessFileName( const
     {
         QString file = m_part->project()->projectDirectory() + "/" + *it;
-        QFileInfo fileinfo(file);
-        QString canonicalFile = fileinfo.dir().canonicalPath() + "/" + \
                fileinfo.fileName();
-        if ( name == canonicalFile )
+        if ( name == canonicalPath( file ) )
         {
             kdDebug(9004) << "Found file in project - " << file << " == " << name << \
endl;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic