pspad:
--------------------------------------------------------------------------------
I am sorry. I was wrong. Project has higher priority than file on the disk. 
I will change logic. If log parser will return file include path, PSPad will
open this file if possible.
--------------------------------------------------------------------------------


Is there any way you could make it slightly more complex? My issue is that the
compile is returning a relative path (not a full one), eg

mysubdir/network.c:482:4 error: expected ';'

but if there's another file earlier in the project (say anothersubdir/network.c
) it's _that_ file that opens when I double-click; I guess you're matching just
the leaf name and stopping at that point?

Is there a way that you could parse the entire project for the "best match", if
you like? So (in pseudocode) something like this:

bestMatchpos=len(logFileName)
bestMatchFN="notfound"
while (fn=getnextfilename()) {
// can we match the whole search string to the RHS of the project filename's
path?
        if (substr(fn, len(fn)-len(logFileName))==logFileName) {
        return fn
        }
// is it a better match than the last one?
        matchPos=positionOfLastMatchingSlash(logFileName, fn)
        if (matchPos < bestMatchPos) {
                bestMatchFN=fn
                bestMatchPos=noMatchPos
        }
        return bestMatchFN
}

function positionOfLastMatchingSlash(string s1, string s2) {
        i=len(s1)
        j=len(s2)
        lastsl=i
        while (i > 0 && j > 0) {
                if (h[j]!=n[i] && !((h[j]==char(92) || h[j]=='/') && 
(n[i]==char(92) ||
n[i]=='/'))) {
// it's neither the same char nor a slash
                        break;
                }
                if (h[j]=='/' || h[j]==char(92))
// we've matched a slash, so we've matched up to this node
                        lastsl=i
                }
                i--;
                j--;
        }
// so now we should have the position of the last slash that matched 
        return lastsl;
}

Obviously it's not tested and apologies that indents don't come out, but
hopefully it gives you the gist of what I mean.

-- 
<http://forum.pspad.com/read.php?4,62695,63466>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem