Delphi 5 to Delphi 6 conversion

Hi 

We are moving our product from D5 to D6. 

I have dealt with all the deprecated functions.

However, we are getting various platform specifc warnings. These include:

Symbol 'FileGetAttr' is specific to a platform
Symbol 'FileSetAttr' is specific to a platform
Symbol 'faReadOnly' is specific to a platform

We want this conversion to be carried out correctly. 
We don't view the simple solution of switching off those warnings or symbols as being the correct way. 
What we want is the same platform independence as other functions. 
For example, all of our IncludeTrailingBackslash function calls were replaced with IncludeTrailingPathDelimiter calls. 

Is there a sensible way to sort out these 3 warnings in the same manner, so that the final executable will be platform independant?

Thanks
Tony Danby
0
tony
3/3/2009 12:15:14 PM
embarcadero.delphi.vcl.using 2297 articles. 2 followers. Follow

5 Replies
1853 Views

Similar Articles

[PageSpeed] 45

> We are moving our product from D5 to D6. 
> 
> I have dealt with all the deprecated functions.
> 
> However, we are getting various platform specifc warnings.

D6 was the first version following the release of Kylix, so given Kylix
is now a discontinued product, you *could* turn off the platform
warnings with a reasonablely clear conscience (i.e., the 'platform'
differences in question are those between Windows and Linux).  That
said, I avoid doing this myself if I can, just like you.

> Symbol 'FileGetAttr' is specific to a platform
> Symbol 'FileSetAttr' is specific to a platform
> Symbol 'faReadOnly' is specific to a platform

Check out the FileIsReadOnly and FileSetReadOnly functions in SysUtils.
If you're twiddling any attribute other than faReadOnly though,
temporarily turning off the resulting warning is the sensible thing to
do for this particular case.  The only alternative, I think, would be
to make the platform specificness explicit by using the equivalent API
functions and constants.
0
Chris
3/3/2009 1:10:03 PM
On Tue, 3 Mar 2009 04:15:14 -0800, tony danby wrote:

> Hi 
> 
> We are moving our product from D5 to D6. 
> 
> I have dealt with all the deprecated functions.
> 
> However, we are getting various platform specifc warnings. These include:
> 
> Symbol 'FileGetAttr' is specific to a platform
> Symbol 'FileSetAttr' is specific to a platform
> Symbol 'faReadOnly' is specific to a platform
> 
> We want this conversion to be carried out correctly. 
> We don't view the simple solution of switching off those warnings or symbols as being the correct way. 
> What we want is the same platform independence as other functions. 
> For example, all of our IncludeTrailingBackslash function calls were replaced with IncludeTrailingPathDelimiter calls. 
> 
> Is there a sensible way to sort out these 3 warnings in the same manner, so that the final executable will be platform independant?

File attributes are by their nature platform dependant (UNIX
attributes are very different to Windows attributes). If you jus want
to check vhe readonly attribute then use
FileIsReadOnly/FileSetReadOnly. If you need more control then I
suggest that you create similar wrapper functions in a seperate unit
and turn off platform warnings for that unit only.

-- 
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
0
Marc
3/3/2009 1:27:17 PM
Chris - Thanks for that, that is exactly what we need for now.
0
tony
3/3/2009 1:52:11 PM
Marc - Thanks for that, it adds strength to what Chris has said, plus it made me think about other longer term solutions.
0
tony
3/3/2009 1:53:11 PM
<tony danby> wrote in message news:87770@forums.codegear.com...

> However, we are getting various platform specifc warnings. These include:
>
> Symbol 'FileGetAttr' is specific to a platform
> Symbol 'FileSetAttr' is specific to a platform

Those functions are only implemented on the Windows platform.  That is why 
they are marked with the 'platform' keyword now.  If you want your code to 
be portable to other platforms, then you have to re-write the code to use 
your own platform-agnostic functions.  Otherwise, just ignore the warnings 
if you are only targetting the Windows platform.

> Symbol 'faReadOnly' is specific to a platform

The only non-Windows function that uses faReadOnly is FindMatchingFile(). 
It uses faReadOnly on Windows and Linux.  The rest of the uses of faReadOnly 
are specific to Windows only.

> What we want is the same platform independence as other functions.

Then you need to find other functions to use.  The ones you are using are 
specific to Windows.

-- 
Remy Lebeau (TeamB)
0
Remy
3/3/2009 10:48:02 PM
Reply: