FileUtil, LCL and Console Application lazarus / 31-LCL ---------------------------------------------------------------------- agb · 2011-04-17 19:59 Hi, All! Simple question) In FileUtil unit placed useful functions for processing file names. Why I can not use them in ConsoleApplication? Is it possible make those useful functions more usable in other programming environments, except GUI? -- Anton. ---------------------------------------------------------------------- agb · 2011-04-17 20:12 Found this: http://www.freepascal.org/docs-html/rtl/sysutils/filenameroutines.html So - why duplication? SysUtils vs FileUtil. ---------------------------------------------------------------------- marcov · 2011-04-18 10:00 Such duplication is usually because Lazarus regards ansistrings as UTF8, while FPC regards them as having the native encoding (whatever that is) ---------------------------------------------------------------------- Leledumbo · 2011-04-18 16:24 QuoteSo - why duplication? SysUtils vs FileUtil.Another possibility would be extensions to SysUtils, such as ExtractFileNameOnly and FileSize function. ---------------------------------------------------------------------- marcov · 2011-04-19 08:39 Quote from: Leledumbo on April 18, 2011, 06:24:27 pmQuoteSo - why duplication? SysUtils vs FileUtil.Another possibility would be extensions to SysUtils, such as ExtractFileNameOnly and FileSize function. General functions should be propagated back. We also do this with Windows headers, where Lazarus has its own cache of headers (unit win32extra or so) that is from time to time absorbed into the general windows headers. Now is a good moment to flag content for migration back to FPC, with a major version coming up this summer or fall, but still early enough to merge a bunch of procedures. ---------------------------------------------------------------------- Shebuka · 2011-04-19 12:39 Quote from: Leledumbo on April 18, 2011, 06:24:27 pmQuoteSo - why duplication? SysUtils vs FileUtil.Another possibility would be extensions to SysUtils, such as ExtractFileNameOnly and FileSize function. Today I was fighting with a bug in Mac version of my application, it receives via web some absolute path from Win32 version of my application and use ExtractFileNameOnly(); to extract file name. And here is the bug. ExtractFileNameOnly do a while cycle over chars in FileName and seek until ':' or PathDelim is found, but on Mac (unix in general) PathDelim is / and in Windows is \ so ExtractFileNameOnly gives me the exact same Win FileName only with cutted extension... I'v made my own function which is equal to fileutil.inc except for line 640: 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     and not (Char(AFilename[StartPos-1]) in AllowDirectorySeparators)    {$IFDEF Windows}    and (AFilename[StartPos-1]<>PathSep){$ENDIF}(with another fix, PathSep instead of ':') Do you think this one is correct or it can produce some unpredictable output with backward compatibility? ---------------------------------------------------------------------- Shebuka · 2011-04-26 08:31 Quote from: Shebuka on April 19, 2011, 02:39:46 pm[...] Do you think this one is correct or it can produce some unpredictable output with backward compatibility? So?