How to detect Classic?

Jan Decroos jan.decroos at groepvanroey.be
Fri Jan 16 07:39:13 EST 2004



You can check which environment your application is running by checking the
processID, which returns the real process ID if running under OS X (it must
appear in the first column of the result of 'ps -c -U myAccountName'), and it
returns 9000 if running under Classic.
(Every application started under Classic is a sub-process (AFAIK) of
TruBlueEnvironment (Mac OS 9 Classic), and you don't find the value of the
processID function back in the first column.)


on mouseUp
  if isRunningClassic() then
    answer "Classic"
  else
    answer "OS X"
  end if
end mouseUp

function isRunningClassic
  set the itemDel to "/"
  put last item of $HOME into myAccountName
  get((CR&space&space&(the processID)&space) is in (CR&shell("ps -c -U
"&myAccountName)))
  return not(it)
end isRunningClassic

Regards,
Jan
>
>
>I have an app that I built for both PPC & OS X. The 2 systems handle 
>file paths differently so I have a routine to convert from one to the 
>other depending on "the systemVersion". The problem is that I was 
>testing the PPC version using Classic from inside OS X. My conversion 
>routine wasn't working so none of the expected files could be found. I 
>finally tracked this down to the fact that when running in Classic as 
>opposed to having booted into OS 9, the systemVersion still returns 
>10.3.2
>
>So the Rev engine thought it was still operating in OS X but insisted 
>on OS 9 file paths! Does anyone have any ideas on how to detect when an 
>OS 9 app is running in Classic? I guess if not, I'll just have to do 
>separate builds for each version with the system type stored in a 
>custom property.
>
>Cheers,
>Sarah
>sarahr at genesearch.com.au
>http://www.troz.net/Rev/
>



More information about the use-livecode mailing list