Why is this needed? The file references are always relative AFAIK.
Unfortunately no, not on windows at least. If you use the "Add files from the filesystem" and the file is not in the current directory, Project Inspector will add the full path of the file(see attached image). You don't have to take to the extreme, like spreading the files to c: and d: drives.
Otherwise paths in .lpi should not need adjustment because the directory structure is always kept.
Since the lpi contains absolute paths, like the one in the screenshot, taking the published folder to another computer where the particular file does not exists, will lead to load/build failure. This is why I update the lpi file. Every path becomes relative to the published folder, more precisely relative to the lpi file inside the published folder. Under Linux/GTK2(just tested) apparently the paths are always relative, which is good.
I don't think we should even support such weirdness.
In my opinion we should support it. As the current thread already showed, people do weird stuff, even if it's not recommended. Ideally no matter how spread the project is, the publish feature should bring it to one common folder, preserving the directory structure, but I don't want to insist on this subject, I can easily remove the support if necessary.
FDestProjFiles seems redundant. It is filled by iterating project files: "for i:=0 to CurProject.UnitCount-1 do"
Why not iterate them again when needed? It is used for updating paths in .lpi which also may be useless
FDestProjFiles contains the destination files, the one in the published folder, CurProject.UnitCount refers to the actual units. Again this is only needed when absolute path are used.
Why is another FindAllFiles() needed for the zipper? We already know which files were copied. BTW, FindAllFiles() uses the same TFileSearcher class that we already use.
OK, this one is indeed redundant. FDestProjFiles can be used to construct the zip file.
Why all the UpperCase() calls? The code in Lazarus dealing with units, projects and packages does not UpperCase everything yet it works. What happens if you remove them?
Call me paranoid, but I always compare strings with upper/lower case. Most likely will work without uppercase too.