Re: [fpc-pascal] GetCurrentDir
Henry Vermaak wrote: On Mon, Apr 22, 2013 at 09:57:06AM +0200, Michael Van Canneyt wrote: On Mon, 22 Apr 2013, Marco van de Voort wrote: In our previous episode, Mattias Gaertner said: The FPC code tries to work its way up from '.' in such a case. I just tried, but it gives a correct result in my case. Maybe as fallback it can use the environment variable PWD? No. That would only be valid right after startup, and doesn't change when you chdir in the program. +1 I think that readlink on /proc/self/cwd should work? Could be problematic if the share is in a form that the kernel can't parse. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GetCurrentDir
On Mon, 22 Apr 2013, Henry Vermaak wrote: On Mon, Apr 22, 2013 at 09:57:06AM +0200, Michael Van Canneyt wrote: On Mon, 22 Apr 2013, Marco van de Voort wrote: In our previous episode, Mattias Gaertner said: The FPC code tries to work its way up from '.' in such a case. I just tried, but it gives a correct result in my case. Maybe as fallback it can use the environment variable PWD? No. That would only be valid right after startup, and doesn't change when you chdir in the program. +1 I think that readlink on /proc/self/cwd should work? That is what the kernel getcwd returns. Sometimes this is empty. Michael. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GetCurrentDir
On Mon, Apr 22, 2013 at 09:57:06AM +0200, Michael Van Canneyt wrote: > On Mon, 22 Apr 2013, Marco van de Voort wrote: > >In our previous episode, Mattias Gaertner said: > >>>The FPC code tries to work its way up from '.' in such a case. > >>> > >>>I just tried, but it gives a correct result in my case. > >> > >>Maybe as fallback it can use the environment variable PWD? > > > >No. That would only be valid right after startup, and doesn't change > >when you chdir in the program. > > +1 I think that readlink on /proc/self/cwd should work? Henry ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GetCurrentDir
On Mon, 22 Apr 2013, Marco van de Voort wrote: In our previous episode, Mattias Gaertner said: The FPC code tries to work its way up from '.' in such a case. I just tried, but it gives a correct result in my case. Maybe as fallback it can use the environment variable PWD? No. That would only be valid right after startup, and doesn't change when you chdir in the program. +1 Michael. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GetCurrentDir
In our previous episode, Mattias Gaertner said: > > The FPC code tries to work its way up from '.' in such a case. > > > > I just tried, but it gives a correct result in my case. > > Maybe as fallback it can use the environment variable PWD? No. That would only be valid right after startup, and doesn't change when you chdir in the program. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GetCurrentDir
On Mon, 22 Apr 2013 09:04:30 +0200 (CEST) Michael Van Canneyt wrote: > > > On Sun, 21 Apr 2013, Mattias Gaertner wrote: > > > Hi, > > > > On one of my Linux machines GetCurrentDir returns '', when the working > > directory is a samba share. > > Is this a feature or a bug? > > It can happen. The linux kernel returns an empty cwd in some cases. > The FPC code tries to work its way up from '.' in such a case. > > I just tried, but it gives a correct result in my case. Maybe as fallback it can use the environment variable PWD? Mattias ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GetCurrentDir
On Sun, 21 Apr 2013, Mattias Gaertner wrote: Hi, On one of my Linux machines GetCurrentDir returns '', when the working directory is a samba share. Is this a feature or a bug? It can happen. The linux kernel returns an empty cwd in some cases. The FPC code tries to work its way up from '.' in such a case. I just tried, but it gives a correct result in my case. Michael. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] GetCurrentDir
Hi, On one of my Linux machines GetCurrentDir returns '', when the working directory is a samba share. Is this a feature or a bug? Mattias ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
