Jump to content

Uwe Raabe

Members
  • Content Count

    2541
  • Joined

  • Last visited

  • Days Won

    147

Posts posted by Uwe Raabe


  1. There is an unofficial download available for MMX Code Explorer with Delphi 10.3 Rio support. Unofficial because it didn't have had much testing yet due to some incompatibilities found during the beta phase. One of this results in the loss of the MMX editor context menu entry.

     

    Another big change ist that MMX version 14.x only supports Delphi 10 Seattle and higher. For that, version 13 will still be available for download and installations for older Delphi versions should keep working. I had to make this cut to avoid wasting too much time just to make it work and test it on those older versions.

     

    Nevertheless there are some features and bug fixes:
     

    • Unit Dependency Analyzer is now dockable (so you can see immediately when you introduce cyclic dependencies)
    • New settings page Project Options (currently contains only the setting for Uses Clause Sorting). These settings are stored per project in a separate section of the dproj file.
    • Uses Clause Sorting accepts lists like (ToolsApi,DesignIntf) as one group. This only affects grouping, so the order inside this list is not relevant.
    • Uses Clause Sorting accepts wildcards like Rz* (for Raize Components) or Id* (for Indy) to better handle non-dotted unit names
    • New sorting options "group class members" - keeps the class methods together
    • fix: Wrong result when renaming parameter during Extract Method
    • fix: Add Local Variable now also works with For-In clause
    • fix: Hard coded string scan check for min length works correct now
    • fix: Paste Interface in empty class just works now
    • fix: Consolidated behavior of selected file in Open/Use Unit dialog
    • fix: Creational Wizard follows static/non-static when suggesting destructors

     

    Some work has been done for supporting themes, but that is still a long road to go. 

     

    Please report any bugs and problems found either here or via support@mmx-delphi.de.

    • Like 5
    • Thanks 7

  2. 12 minutes ago, Georgge Bakh said:

    For example, some third unit3 used TClass1 from the unit1 from which we moving TClass1 to unit2. In order to keep the code correct we need to update unit3 accordingly.

    No, you have to add unit2 to the uses clause of unit3 manually. You might also be able to remove unit1 from the uses clause.


  3. Look at the different overloads of GetFiles and use that one matching your needs. If you have to specify TSearchOption.soAllDirectories you should specify that to the appropriate overload.

     

    files := TDirectory.GetFiles('C:\Temp\', TSearchOption.soAllDirectories, 
        function(const Path: string; const SearchRec: TSearchRec): Boolean
        begin
          Result := TPath.MatchesPattern(SearchRec.Name, '*.exe') or
                    TPath.MatchesPattern(SearchRec.Name, '*.dll');
        end);

     

    • Thanks 1

  4. If you want only files use GetFiles. If you want only folders use GetDirectories. If you want both use GetFileSystemEntries. You don't need multiple calls - at least I can't imagine a use case for it in the moment. If you want all DLL and EXE files use the code I gave as an example.

     

    The Embarcadero example above selects the correct method to call depending on the given parameters - admitted in a somewhat weird way. It never calls more than one GetXXX method, because the three if-clauses are mutually exclusive.

     

    BTW, the loop to add the LList to the TStringlist can be replaced by a simple AddStrings call in recent Delphi versions.

    Also returning a TStringList instance as a function result is not a first class approach anyway. That's why all the IOUtils functions return string arrays.


  5. TDirectory.GetFiles/GetDirectories/GetFileSystemEntries have overloads taking a TFilterPredicate. You can provide your own accept function with that. The following example lists all dll and exe files from the given folder in one go.

     

    files := TDirectory.GetFiles('C:\Temp\',
        function(const Path: string; const SearchRec: TSearchRec): Boolean
        begin
          Result := TPath.MatchesPattern(SearchRec.Name, '*.exe') or
                    TPath.MatchesPattern(SearchRec.Name, '*.dll');
        end);

     

    • Like 3

  6. 35 minutes ago, KodeZwerg said:

    and IOUtils offer TPath, where i have less experience.

    I guess you are referring to TDirectory.GetFiles here as TPath has no such functionality. Well, that is merely a wrapper for FindFirst/FindNext so not actually a new approach and such not worth investigating in terms of speed over convenience.


  7. Create or extend a file named UserTools.proj in %APPDATA%\Embarcadero\BDS\19.0 (for 10.2 Tokyo) with the following code:

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
           <DCC_Define>FrameWork_$(FrameworkType);$(DCC_Define)</DCC_Define>
        </PropertyGroup>
    </Project>

    Now you can check for the project framework with {$IFDEF FrameWork_VCL} and  {$IFDEF FrameWork_FMX}.

    • Like 2
    • Thanks 4
×