[fpc-pascal] Case insensitive FindFirst and friends

2009-05-18 Thread Brad Campbell
G'day all, I've got a little application I'm working on that is compiled for Darwin, Linux and Win32 and I've bumped up against case sensitivity in FindFirst and friends. In this application I'm populating a stringlist with a list of files in a directory with a specific extension, but of

Re: [fpc-pascal] Case insensitive FindFirst and friends

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 08:18, Brad Campbell wrote: In this application I'm populating a stringlist with a list of files in a directory with a specific extension, but of course I've just realised that the case of that extension is tripping me up. Is there a better way to achieve what I want in

Re: [fpc-pascal] Case insensitive FindFirst and friends

2009-05-18 Thread Brad Campbell
Jonas Maebe wrote: On 18 May 2009, at 08:18, Brad Campbell wrote: In this application I'm populating a stringlist with a list of files in a directory with a specific extension, but of course I've just realised that the case of that extension is tripping me up. Is there a better way to

[fpc-pascal] DBus interface needs an update

2009-05-18 Thread Matthias Klumpp
Hello! I've spent hours to get the Pascal DBus interface working for me, but even the example code does not work. The DBus package is very old, as it was created, DBus has not reached version 1.0 yet, I think because of that DBus Pascal is not working today. It would be great if someone could

Re: [fpc-pascal] DBus interface needs an update

2009-05-18 Thread ik
Since you are all into it already, you are welcome to give patches to solve the problems :) Ido On Mon, May 18, 2009 at 2:38 PM, Matthias Klumpp matth...@nlinux.orgwrote: Hello! I've spent hours to get the Pascal DBus interface working for me, but even the example code does not work. The

Re: [fpc-pascal] Case insensitive FindFirst and friends

2009-05-18 Thread dmitry boyarintsev
I think the only real solution is accept that different OSes do not behave exactly the same, as this will by no means be the only difference they'll encounter. Actually, FindFirst is not OS dependant, but disk partition dependant. I.e. searching on FAT disk in Unix should also be case

[fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé
Hi, I ported a Delphi service to linux using FPC. The app uses FindFirst, FindNext and FindClose the same way Delphi Help shows: if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then begin repeat ... ... until FindNext(sr) 0; FindClose(sr); end; Apparently my program gets stuck after

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: Apparently my program gets stuck after a couple (several, in fact) of calls to the function that includes this code. By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as follows: if

Re: [fpc-pascal] DBus interface needs an update

2009-05-18 Thread Prince Riley
Matthias, You might want to take a look at the thread (see below) on this I found On 10/15/06, Marco van de Voort [EMAIL PROTECTED] wrote: Florian, afaik Sebastian already had DBus stuff. He demonstrated it in Muenchen? Arg, duplicated work? Well ... he should have written somewhere that

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: Apparently my program gets stuck after a couple (several, in fact) of calls to the function that includes this code. By reading the FPC.RTL documentation, I found it says that FindClose must be

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé
You are not alone Michael, I also have to rewrite all of my FindFirst...FindClose calls :). By reading the documentation a little more, I found that the unit OldLinux includes the Glob() function to search for files in Linux. This function returns a pointer that must be explicitly disposed by

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 17:25, Michael Van Canneyt wrote: On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as follows: if FindFirst(Edit1.Text,

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 17:25, Michael Van Canneyt wrote: On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread fpclist
I must agree with Michael. In my experience, it doesn't matter where the findclose() is placed, as long as it's called within the scope of the findfirst(), findnext(). If findclose() is not called, all that happens is that the OS will use up file handles, which are finite in quantity on any

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jürgen Hestermann
Is that correct: http://www.delphifaq.com/faq/delphi/windows_file_system/f419.shtml ? If yes, then you need IFDEFs to distinguish between Linux and Windows. ;-( Jürgen Hestermann ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] DBus interface needs an update

2009-05-18 Thread Matthias Klumpp
Well, okay. Because I changed the code frequently, I dont't know if this is the right solution to do the task, but it does not work like all other trials. I use the following function: (Include unit dbus): function CallDBus: Boolean; var err: DBusError; conn: PDBusConnection; ret: cint;

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: Yes. Huh ? Since when is this requirement ? Since as long as I can remember. It at least predates the switch to svn (revision 1 of both rtl/unix/dos.pp and of rtl/unix/sysutils.pp requires it). The current situation is probably simply

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Marco van de Voort wrote: In our previous episode, Jonas Maebe said: Yes. Huh ? Since when is this requirement ? Since as long as I can remember. It at least predates the switch to svn (revision 1 of both rtl/unix/dos.pp and of rtl/unix/sysutils.pp requires it).

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 18:15, Michael Van Canneyt wrote: As far as I know, the FindClose is only needed when FindFirst returned zero. That has never been true on FPC/unix, as far as I can see. Jonas ___ fpc-pascal maillist -

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé
This sounds good, just also check what happens if FindClose receives an invalid handle. Leonardo M. Ramé http://leonardorame.blogspot.com --- On Mon, 5/18/09, Michael Van Canneyt mich...@freepascal.org wrote: From: Michael Van Canneyt mich...@freepascal.org Subject: Re: [fpc-pascal]

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Leonardo M. Ramé wrote: This sounds good, just also check what happens if FindClose receives an invalid handle. That was the second line in my line count estimate ;-) Michael.___ fpc-pascal maillist -

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: Opinions ? If no-one objects, I'll implement the 'fix', it's only 2 lines of code. No fundamental objections, but maybe wait till just before a release to avoid packages that work with both 2.2.4 and 2.3.1 having to ifdef till the next release?

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Marco van de Voort wrote: In our previous episode, Michael Van Canneyt said: Opinions ? If no-one objects, I'll implement the 'fix', it's only 2 lines of code. No fundamental objections, but maybe wait till just before a release to avoid packages that work with

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 21:03, Michael Van Canneyt wrote: I checked the windows code, and FindClose explicitly checks that the searchrec record contains a valid handle (i.e. NOT INVALID_HANDLE_VALUE), so all platforms would behave the same. Opinions ? If no-one objects, I'll implement the 'fix',

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Tomas Hajny
On 18 May 09, at 22:10, Jonas Maebe wrote: On 18 May 2009, at 21:03, Michael Van Canneyt wrote: I checked the windows code, and FindClose explicitly checks that the searchrec record contains a valid handle (i.e. NOT INVALID_HANDLE_VALUE), so all platforms would behave the same.