#!/usr/bin/env python
#-*- coding:utf-8 -*
import os
import sys
#===================================================#
# Obtention du bon chemin d'execution #
#===================================================#
def cxf_get_path():
"""
Allow to know the good path under Linux, MAC, and Windows.
Under Windows, adapt the path betwwen direct execution or
trough cx_freeze or PYXMAKER
PARAMETERS
==========
None
RETURNS
=======
The execution path, adapted to the situation
"""
#OS = Linux
if sys.platform == 'linux2':
path = os.path.dirname(os.path.abspath(__file__))
#OS = Windows
elif sys.platform in ("win32", "cygwin"):
if getattr(sys, 'frozen', False):
path = os.path.dirname(sys.executable)
else:
path = os.path.dirname(os.path.abspath(__file__))
#OS = MAC
else:
path = os.path.dirname(os.path.abspath(__file__))
return path
Partager