Recent

Author Topic: FileUtils and UTF8 (SOLVED)  (Read 5902 times)

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
FileUtils and UTF8 (SOLVED)
« on: November 09, 2016, 03:57:43 pm »
In the UTF8 fpc/laz update roadmap, which version depreciated 'uses fileutil' to be replaced with uses 'LazUTF8,LazFileUtils,FileUtil' ?
I need a DEFINE directive for some older projects.
« Last Edit: November 09, 2016, 11:51:16 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Bart

  • Hero Member
  • *****
  • Posts: 5714
    • Bart en Mariska's Webstek
Re: FileUtils and UTF8
« Reply #1 on: November 09, 2016, 04:33:48 pm »
FileUtils is kept for backwards compaitibility.
Most of the routines that need to handle UTF8 strings are moved to LazFileUtils unit.

LazUtf8 unit has functions for UTF8 string manipulation mostly.

Bart

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: FileUtils and UTF8
« Reply #2 on: November 09, 2016, 04:51:17 pm »
FileUtils is kept for backwards compaitibility.
Most of the routines that need to handle UTF8 strings are moved to LazFileUtils unit.

LazUtf8 unit has functions for UTF8 string manipulation mostly.

Bart
Thanks for that, but I'm looking for an {$IFDEF} directive for older code, which doesn't compile with the 'uses FileUtil' under Laz1.7/fpc3.1.1.
Something like {$IFDEF}fpcxxx  uses FileUtil{$Else}uses LazUTF8,LazFileUtils,FileUtil, {$ENDIF}

My older code uses xxxfunctionUTF8 quite a lot.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

wp

  • Hero Member
  • *****
  • Posts: 13502
Re: FileUtils and UTF8
« Reply #3 on: November 09, 2016, 05:07:09 pm »
Isn't is ok to "use" both, FileUtils and LazFileUtils? The oldest Lazarus version on my system is 1.0, and it already has LazFileUtils. So, if your project "uses LazFileUtils, FileUtils" it will compile with Laz1.0, and Laz will find the routines which are in LazFileUtils now in FileUtils. And if you compile with Laz-trunk it will ignore the FileUtils and find the routines in LazFileUtils.

Thaddy

  • Hero Member
  • *****
  • Posts: 19123
  • Glad to be alive.
Re: FileUtils and UTF8
« Reply #4 on: November 09, 2016, 05:07:56 pm »
You should not "ifdef" but adapt your code to use LazFileUtils unless there is a very strong reason to do otherwise.
I maintain museum pieces of software, but it's not fun or really warranted.
Better to zip the whole shebang and store it somewhere with the appropriate compiler version.
objects are fine constructs. You can even initialize them with constructors.

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: FileUtils and UTF8
« Reply #5 on: November 09, 2016, 05:25:20 pm »
Isn't is ok to "use" both, FileUtils and LazFileUtils? The oldest Lazarus version on my system is 1.0, and it already has LazFileUtils. So, if your project "uses LazFileUtils, FileUtils" it will compile with Laz1.0, and Laz will find the routines which are in LazFileUtils now in FileUtils. And if you compile with Laz-trunk it will ignore the FileUtils and find the routines in LazFileUtils.
That's the info I was looking for.  Thanks @wp.

I haven't kept up-to-date with changes to the FileUtil unit. I noticed with fpcv3.x that FileUtil had an {$IFDEF EnableWrapperFunctions} around all the UTF8 functions I used to use, and that these functions no longer compiled in fpc 3.1.1/Laz1.7.

I was asking when this EnableWrapperFunctions directive was introduced.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Bart

  • Hero Member
  • *****
  • Posts: 5714
    • Bart en Mariska's Webstek
Re: FileUtils and UTF8
« Reply #6 on: November 09, 2016, 06:18:29 pm »
"uses LazFileUtils, FileUtils"

Better swap those around, it will give less hints about using deprecated functions in FileUtil unit.

Bart

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: FileUtils and UTF8 (SOLVED)
« Reply #7 on: November 09, 2016, 11:51:55 pm »
OK - Solved.  Thanks.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

 

TinyPortal © 2005-2018