Re: Finding pvconv
Derrick Hudson <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jan 17, 2005 at 08:49:11PM -0800, Roger Binns wrote:
| >On Unix systems (linux and Mac OS X included), you should look in all
| >directories listed in os.environ['PATH'] unless you let users set the
| >location
| >of the thing you are looking for in the preferences.
|
| I don't care enough to do that (look in all of $PATH or have preferences).
It has a better chance of working on more systems, since that is the
way applications are supposed to be found.
Anyways :
def find_file_in_PATH(fname) :
import os
for dir in os.environ['PATH'].split(os.pathsep) :
if os.path.exists(dir) and fname in os.listdir(dir) :
return os.path.join( dir, fname )
pvconv = find_file_in_PATH( 'pvconv' )
This is python, not C! 'It is quite trivial to do the search.
(PS. you can do what you want with this code; I place no restrictions
or copyright on it)
| pvconv won't even work on many modern Linuxes (it was compiled with some
| random version of the C++ libraries).
Binary-only software generally sucks precisely because of this. Isn't
there an OSS tool capable of doing the necessary conversion?
| And giving people too much choice never solves anything.
There is a such thing as "too much", but no choice at all is even
worse.
| That is one of the reasons Unix/Linux is annoying
| to use - you get way too many choices, and not enough sensible defaults.
Some applications and/or distributions have sensible defaults, some
others don't.
-D
--
There is not a righteous man on earth
who does what is right and never sins.
Ecclesiastes 7:20
www: http://dman13.dyndns.org/~dman/ jabber: [email protected]
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFB8SVFiB6vp1xAVUARAhNaAKCZQWyOyaxNcVxtpmm4jNoD7AQLkACdHdrZ iKm0RbmCShTkR5CASffayLI= =UYfV -----END PGP SIGNATURE-----