[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-25 23:50:07
[Download RAW message or body]

CVS commit by dagerbo: 

Fix for Bug #57510. 


  M +38 -12    makewidget.cpp   1.82


--- kdevelop/parts/outputviews/makewidget.cpp  #1.81:1.82
@@ -400,16 +400,42 @@ QString MakeWidget::directory(int parag)
 QString MakeWidget::guessFileName( const QString& fName, int parag ) const
 {
+    // pathological case
+    if ( ! m_part->project() ) return fName;
+
+    QString name;
+
         if ( fName.startsWith( "/" ) )
-                // absolut path given
-                return fName;
-        if ( fName.contains( "/" ) ) {
-                // relative path to the project dir
-                if ( m_part->project() )
-                        return m_part->project()->projectDirectory() + "/" + fName;
+    {
+        // absolute path given
+        name = fName;
+    }
+    else if ( fName.contains( "/" ) )
+    {
+        // assume relative path to the project dir
+        name = m_part->project()->projectDirectory() + "/" + fName;
+    }
                 else
-                        return fName;
+    {
+        // no path given, try to guess the active directory from output
+        name = directory( parag ) + fName;
         }
-        // else - no path given, try to guess the active directory from output
-        return directory( parag ) + fName;
+
+    // GNU make resolves symlinks. if "name" is a real path to a file the
+    // project know by symlink path, we need to return the symlink path
+    QStringList projectFiles = m_part->project()->allFiles();
+    QStringList::iterator it = projectFiles.begin();
+    while ( it != projectFiles.end() )
+    {
+        QString file = m_part->project()->projectDirectory() + "/" + *it;
+        if ( name == QDir(file).canonicalPath() )
+        {
+            kdDebug(9004) << "Found file in project - " << file << " == " << name << endl;
+            return file;
+        }
+        ++it;
+    }
+
+    // this should only happen if the file is not in the project
+    return name;
 }
 


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

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