[fpc-devel] ExtractFileDrive is broken under Linux

Graeme Geldenhuys graemeg.lists at gmail.com
Wed May 21 13:11:21 CEST 2008


Michael Van Canneyt wrote:
  > That depends entirely on your point of view.

I like to be difficult! :-)


> Linux knows no drive letters.
> ':' is a valid character in a filename, and therefor cannot act as a drive
> separator character.

Oh!  I never knew ':' is a valid filename char. Whoever uses that must 
be shot, no questions asked! ;-)  With my new found knowledge, I see 
your point.


>> What if I use a Linux application to process data from a remote Windows
>> system?? I'm now getting inconsistent results!
> 
> Set AllowDriveSeparators to [':']. 

Brilliant, that should do the trick. :)


> Be aware that
>   ExpractFileName('c:\mypath\myfile:otherpart.ext')
> will go wrong in this case.

Nice catch, I better make a note of that as well.


> And to be honest: parsing windows filenames on a linux system or 
> vice versa, always goes wrong somewhere. So the routines only 
> guarantee correct behaviour for the current platform.

What about WebServices or CGI apps running on a Linux server? You could 
very well upload a file containing data generated on a Windows system, 
but the WebService running on a Linux system will process that data.


Thanks for explaining the behaviour change Michael. I'll update my 
applications accordingly.


Regards,
   - Graeme -


_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the fpc-devel mailing list