Nonexisting recent projects are removed form the list lazarus / 9-Editor ---------------------------------------------------------------------- CM630 · 2022-01-04 06:55 I have the following problem: When I try to open a nonexisting recent project it gets removed from the recent list. The reason for the project being nonexistent is that it is stored on an unmounted network drive. Is there a way to prevent the IDE from removing these projects? ---------------------------------------------------------------------- balazsszekely · 2022-01-04 08:33 Quote from: CM630 on January 04, 2022, 07:55:07 amI have the following problem: When I try to open a nonexisting recent project it gets removed from the recent list. The reason for the project being nonexistent is that it is stored on an unmounted network drive. Is there a way to prevent the IDE from removing these projects? 1. Open $(LazarusDir)\IDE\MainBase.pas 2. Go to method DoOpenRecentFile 3. Uncomment the following two lines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //..{ if not FileExistsUTF8(AFilename) then begin   EnvironmentOptions.RemoveFromRecentOpenFiles(AFilename);}//..4. Rebuild IDE Ideally one should add a new checkbox("Keep non existent recent project files in list")  to Tools->Environment->Files. When checked the EnvironmentOptions.RemoveFromRecentOpenFiles part of the code is skipped. Very easy to implement, but somehow I'm under the impression that it wouldn't be a very popular feature. Basically other then you no one would use it. ---------------------------------------------------------------------- CM630 · 2022-01-04 12:01 That code does not seem to be executed when opening a project. I have even aded a message box, but it does not show: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TMainIDEBase.DoOpenRecentFile(AFilename: string);begin  ShowMessage ('Will open project');  if DoOpenEditorFile(AFilename,-1,-1,[ofAddToRecent])=mrOk then    UpdateRecentFilesEnv  else begin    // open failed    if not FileExistsUTF8(AFilename) then     begin      // file does not exist -> delete it from recent file list{      EnvironmentOptions.RemoveFromRecentOpenFiles(AFilename);      UpdateRecentFilesEnv;}    end;  end;end;  Also, I have added some nonsense in the code, so when I received an error, I got sure that the mainbase.pas is really compiled. ---------------------------------------------------------------------- Bart · 2022-01-04 12:32 @CM630: Can you file a bugreport for the feature request to make the removal optional? Please explain your use case (disconnected network share). I don't think you are the only Lazarus user out there that might welcome such a feature. Bart ---------------------------------------------------------------------- Sieben · 2022-01-04 12:38 I think the right place to look for this is OpenProject() in SourceFileManager.pas: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   if Assigned(aMenuItem) and (aMenuItem.Section=itmProjectRecentOpen) then  begin    // Hint holds the full filename, Caption may have a shortened form.    AFileName:=aMenuItem.Hint;    Assert(AFileName = ExpandFileNameUTF8(AFileName),'OpenProject: AFileName is not absolute.');    if MainIDE.DoOpenProjectFile(AFilename,[ofAddToRecent])=mrOk then begin    AddRecentProjectFile(AFilename);    end else begin      // open failed      if not FileExistsCached(AFilename) then begin        EnvironmentOptions.RemoveFromRecentProjectFiles(AFilename);      end else        AddRecentProjectFile(AFilename);    end;  end  else begin //... ---------------------------------------------------------------------- Martin_fr · 2022-01-04 13:04 Quote from: GetMem on January 04, 2022, 09:33:36 amIdeally one should add a new checkbox("Keep non existent recent project files in list")  to Tools->Environment->Files. When checked the EnvironmentOptions.RemoveFromRecentOpenFiles part of the code is skipped. Very easy to implement, but somehow I'm under the impression that it wouldn't be a very popular feature. Basically other then you no one would use it. Actually, you can almost count me in... Except, I moved to a diff solution. I have a "project group" with all my "commonly used projects". => So I no longer depend on "recent projects". However, I have projects on that list that do temporarily disappear. (They only exist on some branches in my version control). "project group" also have a check for non-existence. But with "open last group on IDE start", those are kept in the list (and displayed strike-through). ---------------------------------------------------------------------- CM630 · 2022-01-04 14:10 Thanks to all of you, I have created a feature request ticket: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39530