/usr/share/gps/plug-ins/os_utils.py is in gnat-gps-common 5.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """Utility library used by other plug-ins"""
###########################################################################
## No user customization below this line
###########################################################################
import os, os.path, string
def locate_exec_on_path (prog):
"""Utility function to locate an executable on path."""
if os.name == 'nt':
extensions = string.split(os.getenv('PATHEXT'), os.pathsep)
else:
extensions = [""]
alldirs = string.split (os.getenv('PATH'), os.pathsep)
for file in [os.path.join(dir,prog) for dir in alldirs]:
for ext in extensions:
if os.path.isfile(file+ext):
return file
return ""
def display_name (filename):
if os.name == 'nt' and os.getenv("GNAT_CODE_PAGE") == "CP_ACP":
return unicode(filename, "ISO-8859-1").encode("UTF-8")
else:
return filename
|