I am trying to change the file date on a SYMLINK (not the file that the link points to). Does anyone know if there is a method for this under Windows.
Carsten

Mailing lists / fpc-pascal / 2023-05
6 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
I am trying to change the file date on a SYMLINK (not the file that the link points to). Does anyone know if there is a method for this under Windows.
Carsten
Carsten Bager wroteI am trying to change the file date on a SYMLINK (not the file that the link points to). Does anyone know if there is a method for this under Windows. Carsten
Hello,
Attached is a dirty implementation of "touch" for junctions that I need in the past. I think it can help you to do the same over other kind of links.
Have a nice day.
Hi
I will have a look at it (it looks good at first glance). Thanks
Attached is a dirty implementation of "touch" for junctions that I need in the past. I…
José Mejuto via fpc-pascal said on Wed, 3 May 2023 11:35:50 +0200
Hello, Attached is a dirty implementation of "touch" for junctions
==========================================================
TTouchJunction = class(TCustomApplication)
protected
procedure DoRun; override;
function DateTimeToFileTime(DateTime: TDateTime): TFileTime;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
==========================================================I'm an old Turbo Pascal (mainly 3.x, a little 5.5) guy and don't remember or never saw override and virtual. What do they do?
SteveT
Steve Litt
Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm
Il 03/05/23 16:44, Steve Litt via fpc-pascal ha scritto:
*
Override: When you're dealing with objects, you have the inheritance, that is you may derive a new class (the template of an object) from an existing class and the newly created class inherits all the methods and properties of the parent class. In this case TTouchJunction is declared as a descendant of TCustomApplication, therefore it inherits all the methods and properties. If you need that your object does something different from the methods of its parent, but keep the same name, you must declare that your declaration overrides the ancestors one. If in the body of your new method if you want to execute also the ancestor method you may call it with the keyword "inherited".
*
Virtual: means that this method can be overridden by a descendant class. The same does the keyword Dynamic. The difference has to do with the way the code is allocated in memory. Virtual is optimized for speed, Dynamic for memory.
Hope that it helps.
Giuliano
Giuliano Colla via fpc-pascal said on Wed, 3 May 2023 19:33:25 +0200
Thanks Giuliano, it helps a lot. I'm familiar with the concepts you mentioned from work with Perl, Python and C++, and it's good to know how they're implemented in FPC.
Thanks,
SteveT
Steve Litt
Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm