Have you tried uname? This works on virtually all unix platforms. Here http://en.wikipedia.org/wiki/Uname you'll find a sample output given by different unix flavors. My Fedora 13 64bit gives for uname -r : 2.6.34.7-56.fc13.x86_64 lsb_release on ubuntu 10 64 bit says: no LSB modules are available. On debian lenny for arm: command not found... uname -m gives you also the cpu the os is running on which is also important for porting a program. Ludo
-----Message d'origine----- De : Chris Kelling [mailto:kelli...@cox.net] Envoyé : dimanche 31 juillet 2011 17:30 À : 'Lazarus mailing list' Objet : Re: [Lazarus] Determining OS Thank you for the suggestions so far $ lsb_release seems to give good information, my Fedora 15 machine returns LSB Version: :core-4.0-ia32:core-4,0-noarch In addition, I did a ls of the /etc directory and found a file called system-release-cpe, Looking in it says cpe:/o:fedoraproject:fedora:15 Now, this may be unique to fedora (isnt open source wonderful?), but if all distros have that file, I think that may be the solution, Ive got an ubuntu machine running, too I should look to see what it has. Say what you will about the windows registry, but at least theres a common place to look for and put information. And no, I dont want to start a war over the merits of one OS over another, just trying to make my program portable to the most machines with the least effort for the end user. _____ From: ik [mailto:ido...@gmail.com] Sent: Sunday, July 31, 2011 10:55 To: Lazarus mailing list Subject: Re: [Lazarus] Determining OS On Sun, Jul 31, 2011 at 17:43, Graeme Geldenhuys <graemeg.li...@gmail.com> wrote: 2011/7/31 ik <ido...@gmail.com>: > Please note that system.d is Fedora implementation (v15) so for Linux you > need to detect also the Linux distro, and that's a bit more complicated. Any distro worth using should support the LSB standards. With that being said, you can use the 'lsb_release' command to find out exactly what distribution and version is being used. I'm using Arch Linux and that is my output: ------------------------ $ lsb_release LSB Version: n/a $ ------------------------- But I have the following file: /etc/arch-release I think that looking for /etc/*release is more reliable at the moment for distros. BTW The TRegistry class is cross platform. On Windows it uses Registry, and on other OS, it uses INI files. -------------------------------------------------------------------------- $ lsb_release --help Usage: lsb_release [options] Options: -h, --help show this help message and exit -v, --version show LSB modules this system supports -i, --id show distributor ID -d, --description show description of this distribution -r, --release show release number of this distribution -c, --codename show code name of this distribution -a, --all show all of the above information -s, --short show all of the above information in short format $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 8.04.4 LTS Release: 8.04 Codename: hardy -------------------------------------------------------------------------- -- Regards, - Graeme - Ido _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus