# Path: lib/utils/fileutils.py
# def file_exists(filename):
#     """ returns weather the file exists """
#     return os.path.isfile(os.path.normcase(filename))
# 
# Path: lib/utils/utils.py
# def replace_variables(value, variables):
#     if hasattr(sublime, 'expand_variables'): # ST3, Build 3068
#         # stringify dict
#         for k in variables.keys():
#             variables[k] = str(variables[k]);
#         return sublime.expand_variables(value, variables)
#     else:
#         # sort keys after length, to get $file_path before $file
#         keys = list(variables.keys())
#         keys.sort(key=len, reverse=True)
#         for k in keys:
#             key = "${%s}" % k
#             if key in value:
#                 value = value.replace(key, str(variables[k]))
#     return value
# 
# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()


import os
import sys
from .fileutils import file_exists
from .utils import replace_variables
from .debug import Debug
    except FileNotFoundError:
        pass

    parentdir = os.path.abspath(os.path.join(rootdir, os.pardir))
    if parentdir == rootdir:
        return None
    else:
        return find_tsconfigdir(parentdir)


def expand_variables(path, project=None, use_cache=False):
    variables = {}
    if project is not None:
        variables.update(project.extract_variables(use_cache))
    return replace_variables(path, variables)


# GET TSS PATH
def get_tss_path():
    """ Return path to tss.js """
    return os.path.join(package_path, 'bin', 'tss.js')

# GET TSS PATH
def get_expandglob_path():
    """ Return path to expandglob.js """
    return os.path.join(package_path, 'bin', 'expandglob.js')


def default_node_path(node_path, project=None):
    if node_path == 'none':

# Path: lib/utils/fileutils.py
# def file_exists(filename):
#     """ returns weather the file exists """
#     return os.path.isfile(os.path.normcase(filename))
# 
# Path: lib/utils/utils.py
# def replace_variables(value, variables):
#     if hasattr(sublime, 'expand_variables'): # ST3, Build 3068
#         # stringify dict
#         for k in variables.keys():
#             variables[k] = str(variables[k]);
#         return sublime.expand_variables(value, variables)
#     else:
#         # sort keys after length, to get $file_path before $file
#         keys = list(variables.keys())
#         keys.sort(key=len, reverse=True)
#         for k in keys:
#             key = "${%s}" % k
#             if key in value:
#                 value = value.replace(key, str(variables[k]))
#     return value
# 
# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()


# Path: lib/utils/pathutils.py
import os
import sys
from .fileutils import file_exists
from .utils import replace_variables
from .debug import Debug

    except FileNotFoundError:
        pass

    parentdir = os.path.abspath(os.path.join(rootdir, os.pardir))
    if parentdir == rootdir:
        return None
    else:
        return find_tsconfigdir(parentdir)


def expand_variables(path, project=None, use_cache=False):
    variables = {}
    if project is not None:
        variables.update(project.extract_variables(use_cache))
    return replace_variables(path, variables)


# GET TSS PATH
def get_tss_path():
    """ Return path to tss.js """
    return os.path.join(package_path, 'bin', 'tss.js')

# GET TSS PATH
def get_expandglob_path():
    """ Return path to expandglob.js """
    return os.path.join(package_path, 'bin', 'expandglob.js')


def default_node_path(node_path, project=None):
    if node_path == 'none':

        Debug('notify', 'The setting node_path is set to "none". That is depreciated. Remove the setting.')