In XE5 Delphi finally made it easy for us to get the locations of "Known Folders", adding methods to TPath that do the API calls for you. In earlier Delphi versions you are still stuck with calling the appropriate API's. Here's how you can achieve a TPath like experience yourself.

In XE5 Delphi finally made it easy for us to get the locations of "Known Folders", adding methods to TPath that do the API calls for you. In earlier Delphi versions you are still stuck with calling the appropriate API's. Here's how you can achieve a TPath like experience yourself.
http://softwareonastring.com/2014/09/28/how-to-get-the-location-of-the-users-my-documents-folder

Comments

  1. Daniela Osterhagen thanks for that link. Didn't know about it. I usually defer to the Jedi WinAPI library (http://sourceforge.net/projects/jedi-apilib/) when I have to deal with the Windows API.

    ReplyDelete
  2. "class methods in records require that you mark them with static as well. I have no clue as to why."
    Because there is nothing that could get passed as Self. For a class method on a class that is not static the TClass gets passed as Self. But for records there is nothing like that.
    "It would have been so nice if they had been named “static methods” just like other languages have done."
    No because a static method in other languages is not the same as a class method in Delphi which can be virtual because of the concept of class references (TClass). In fact a static method is a class method with the static keyword. Because then it does not get the Self parameter with the class reference.
    And it also makes a difference if you have class procedure TFoo.Something; and then call TBar.Something (TBar inherits from TFoo) because then the Self argument is different than TFoo.Something.

    ReplyDelete
  3. very usefull for mobile (there are a number of new tpath functions for the hidden folders on mobile phones)

    ReplyDelete
  4. Stefan Glienke Thank you so much for that explanation! Would you add that as a comment on the blog post? I'd do it for you, but I don't want to steal your thunder?

    ReplyDelete
  5. "Even though Windows reports my “My Documents” folder as C:\Users\Marjan\Documents, it actually lives on my D: drive… But Windows handles that in a completely transparent manner for all applications so you don’t need to worry about it."
    I always found it strange to use the word "transparent" to describe this kind of behaviour. For me it's not transparent as in "I can see through it and therefore know what it does." Instead it hides everything from me. Just saying, you are probably using that word correctly because my Prof at uni also used it for describing that concept.

    ReplyDelete
  6. TPath is cross platform, which is nice.

    The fact that FMX.Objects.pas has a TPath (for an entirely different purpose) is not

    ReplyDelete

Post a Comment