limelect 48 Posted November 8, 2020 Let explain the scenario I have someone project to compile. Let assume that the guy does not use an external PAS file for his project. The project has a lot of uses. 1.So I compile there is an error. 2.Look for the uses needed. 3.Copy uses needed Go to the top directory of the project and search for it in a directory. 4. Found the directory. Copy directory. 5. Go to the project option. Go to the search path. 6. Add path. 7.Close. 8 repeat 1 to 7 again. Some of the big projects put 1 Pascal file in a directory. To me, it does not make sense. Now for what is needed. looking for an expert (or just an exe stay on top ) that can alleviate some of the processes. I thought at least adding directories without opening the project option. doing 1 to 4 and adding to tool mite help. Any suggestions? Will adding directories to search path NOT with Delphi will not work since Delphi (i presume) does not load his project file every time. Or will it say a file has changed? Your ideas? Share this post Link to post
FPiette 382 Posted November 8, 2020 I never add path to the project search path, nor to global Delphi path: I always add every file in the project directly. Delphi global path contain only the standard directories setup by Delphi installer. I do that because if have a huge number of units splits into categories, each in his own directory. Adding all those directories to the search path (either global or project) make compilation time much longer. And secondly because it like to see - in project manager - exactly what by program is using. And finally be able to click in the project manager on any file my application is using. Adding files to the project is quicker if you use drap&drop from Explorer to project manager. Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) @FPiette You all right but the problem is NOT you and me Using someone ELSE projects often is a mess with directories. They split the pas files into many directories which make life a bit cumbersome for compilation. I am with Delphi since #1 and still love to learn new stuff by compiling other people's projects. Delphi is my profession AND my hobby Edited November 8, 2020 by limelect Share this post Link to post
FPiette 382 Posted November 8, 2020 14 minutes ago, limelect said: Using someone ELSE projects often is a mess with directories. They split the pas files into many directories which make life a bit cumbersome for compilation. The problem is only when they put directories on different drives. If they are all on the same drive, the IDE maintain relative paths and you can copy the project and the files on another system PRESERVING the directory structure. Then you add all files to the project as I explained instead of adding directories to the search path. Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) @FPiette The problem is simple Start compiling a project first time The error will tell you what is missing in the uses (I am not talking about pas lines error just the uses) On large projects uses errors send you to different uses and so on. This is where the mess starts. Take any project, not yours you do not know what is missing. Edited November 8, 2020 by limelect Share this post Link to post
FPiette 382 Posted November 8, 2020 9 minutes ago, limelect said: On large projects uses errors send you to different uses and so on. This is where the mess starts. Sure, I perfectly know that. I have done it numerous times. You may go the faster route by adding upfront all directories in the search path, where or not they have used source file (You don't know at that time). Then compile the project which should compile fine given the number of directories you added. Then use PascalAnalyzerLite (https://www.peganza.com) to analyze the project. The report (General / Status / Loaded Files) gives the the list of loaded files with their path. Then remove all the directories from the search path and add all files listed by PascalAnalyzerLite and you are done. Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) Ok thanks Edited November 8, 2020 by limelect Share this post Link to post
Uwe Raabe 2057 Posted November 8, 2020 2 hours ago, limelect said: Will adding directories to search path NOT with Delphi will not work since Delphi (i presume) does not load his project file every time. Or will it say a file has changed? If you change the dproj file from outside the IDE, you will get a message when the IDE gets focus again. There is a setting somewhere in the IDE options to suppress these messages and silently reload the changed file. Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 Unfortunately adding to the unit search path of a dproj file is a mess since there are at least 4 entries that need to be changed (maybe one could get away with changing only one and leave it to the IDE to add to the others, but I don't know which one that would be). But creating a program that simply collects paths dropped on it, is far from rocket science. I think I'll put one together within the next 30 minutes. Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) @dummzeuch If you do add to Gexpert that will be cool. If you can submit the source here beforehand I will test it on a project Edited November 8, 2020 by limelect Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 8 minutes ago, dummzeuch said: But creating a program that simply collects paths dropped on it, is far from rocket science. I think I'll put one together within the next 30 minutes. Took me less than 10 minutes. Here you go. I'll put the source on OSDN later. DirectoryCollector.zip Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 On second thought: This doesn't really solve your problem. You still have to add these dirs to the search path, compile, find the next one which is missing, add it and start again. Btw: GExperts makes the search path dialog accept dropped directories already. Share this post Link to post
limelect 48 Posted November 8, 2020 @dummzeuch i do not understand what it does since there is no button to choose a dpr (project) and scann it Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 17 minutes ago, limelect said: @dummzeuch i do not understand what it does since there is no button to choose a dpr (project) and scann it "a program that simply collects paths dropped on it" Share this post Link to post
limelect 48 Posted November 8, 2020 @dummzeuch It seem that PascalAnalyzerLite does it all is needed is to copy put ";" in bitween directorie and copy as a large string. But a small pas software is OK without the large information Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) @dummzeuch Ha ha Ok. The need is scanning for the dcu Edited November 8, 2020 by limelect Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 42 minutes ago, dummzeuch said: I'll put the source on OSDN later. done: https://osdn.net/projects/directorycollector/ Share this post Link to post
limelect 48 Posted November 8, 2020 @dummzeuch It is nice but as you understand this is not the solution because one has to compile to know which dcu is missing and this is tedious PascalAnalyzerLite has the solution but with a lot of overhead which is not needed in my case Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) One more step to automate is to put the directories in dproj and as @Uwe Raabe pointed it will be perfect And another thing I could not find in PascalAnalyzerLite (and I might be wrong) if added directories are someplace else. A list of directories to scan. Maybe I did not look enough well, I took a library out of the project and PascalAnalyzerLite did bring me the old scann. Edited November 8, 2020 by limelect Share this post Link to post
FPiette 382 Posted November 8, 2020 50 minutes ago, limelect said: PascalAnalyzerLite has the solution but with a lot of overhead which is not needed in my case Which overhead? Of course PascalAnalyzerLite does a large number of analyzes you don't know yet you need them 🙂 For example, it will tell you which used units are not really required. Share this post Link to post
limelect 48 Posted November 8, 2020 (edited) 16 minutes ago, FPiette said: Which overhead? Of course PascalAnalyzerLite does a large number of analyzes you don't know yet you need them 🙂 For example, it will tell you which used units are not really required. Pieces of this software we have all over the IDE. But Ok. In my case, I would like one specific piece. CNpack for example clean uses Edited November 8, 2020 by limelect Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 I just found that it is possible to set the search path via OTAPI IOTAProject.GetProjectOptions.Values['DCC_UnitSearchPath'] So in theory it's possible to create a plugin that searches for dcu / pas files, creates a list of possible directories and allows the user to add directories to the search path. Not sure about the amount of work that is necessary for this. It needs a UI too. Share this post Link to post
dummzeuch 1505 Posted November 8, 2020 2 hours ago, dummzeuch said: Unfortunately adding to the unit search path of a dproj file is a mess since there are at least 4 entries that need to be changed Partly wrong: From Delphi 2007 to Delphi 2010 there were 4 entries: DCC_IncludePath DCC_ObjPath DCC_ResourcePath DCC_UnitSearchPath which the IDE all filled with the content of the Search path from the Project Options dialog Starting from XE there is only the entry DCC_UnitSearchPath. Share this post Link to post