summaryrefslogtreecommitdiff
path: root/cad/src/platform_dependent/Paths.py
blob: bccda3b4953ba3667ad33a3bdbf538d2d33bece8 (plain)
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
# Copyright 2008 Nanorex, Inc.  See LICENSE file for details.
"""
Paths.py -- platform dependant filename paths

@author: Bruce, Mark, maybe others
@version: $Id$
@copyright: 2008 Nanorex, Inc.  See LICENSE file for details.
"""

import sys
import os

def get_default_plugin_path(win32_path, darwin_path, linux_path):
    """
    Returns the plugin (executable) path to the standard location for each platform
    (taken from the appropriate one of the three platform-specific arguments),
    but only if a file or dir exists there.
    Otherwise, returns an empty string.
    """
    if sys.platform == "win32": # Windows
        plugin_path = win32_path
    elif sys.platform == "darwin": # MacOS
        plugin_path = darwin_path
    else: # Linux
        plugin_path = linux_path
    if not os.path.exists(plugin_path):
        return ""
    return plugin_path