# Path: grace/utils.py
# def get_path():
#     encoding = sys.getfilesystemencoding()
#     if we_are_frozen():
#         return os.path.dirname(sys.executable)
#     return os.path.dirname(__file__)
# 
# Path: grace/error.py
# class FolderNotFoundError(Error):
#     pass
# 
# class FolderNotWritableError(Error):
#     pass
# 
# class FileNotFoundError(Error):
#     pass
# 
# class FileNotWritableError(Error):
#     pass


from builtins import input
from builtins import object
from .utils import get_path
from shutil import copytree, rmtree
from .error import FolderNotFoundError, FolderNotWritableError, FileNotFoundError, FileNotWritableError
from pkg_resources import resource_filename
import os
import sys

        if not os.path.exists(new_css_dir):
            return

        try:
            self._update_files(new_css_dir, current_css_dir)
        except:
            raise

    def _update_files(self, in_dir, out_dir):
        for path, dirs, files in os.walk(in_dir):
            for f in files:
                file_in_path = os.path.join(path, f)
                directory = path.split(in_dir)[1][1:]
                file_out_path = os.path.join(out_dir, directory, f.replace('_X', ''))
                dir_out_path = os.path.join(out_dir, directory)

                if not os.path.exists(dir_out_path):
                    try:
                        os.makedirs(dir_out_path)
                    except OSError as exc:
                        if exc.errno == errno.EEXIST and os.path.isdir(dir_out_path):
                            pass
                        else:
                            raise
                else:
                    try:
                        os.remove(file_out_path)
                    except:
                        if os.path.exists(file_out_path):

# Path: grace/utils.py
# def get_path():
#     encoding = sys.getfilesystemencoding()
#     if we_are_frozen():
#         return os.path.dirname(sys.executable)
#     return os.path.dirname(__file__)
# 
# Path: grace/error.py
# class FolderNotFoundError(Error):
#     pass
# 
# class FolderNotWritableError(Error):
#     pass
# 
# class FileNotFoundError(Error):
#     pass
# 
# class FileNotWritableError(Error):
#     pass


# Path: grace/update.py
from builtins import input
from builtins import object
from .utils import get_path
from shutil import copytree, rmtree
from .error import FolderNotFoundError, FolderNotWritableError, FileNotFoundError, FileNotWritableError
from pkg_resources import resource_filename
import os
import sys


        if not os.path.exists(new_css_dir):
            return

        try:
            self._update_files(new_css_dir, current_css_dir)
        except:
            raise

    def _update_files(self, in_dir, out_dir):
        for path, dirs, files in os.walk(in_dir):
            for f in files:
                file_in_path = os.path.join(path, f)
                directory = path.split(in_dir)[1][1:]
                file_out_path = os.path.join(out_dir, directory, f.replace('_X', ''))
                dir_out_path = os.path.join(out_dir, directory)

                if not os.path.exists(dir_out_path):
                    try:
                        os.makedirs(dir_out_path)
                    except OSError as exc:
                        if exc.errno == errno.EEXIST and os.path.isdir(dir_out_path):
                            pass
                        else:
                            raise
                else:
                    try:
                        os.remove(file_out_path)
                    except:
                        if os.path.exists(file_out_path):

                            raise FileNotWritableError('Could not remove the old file at: ' + file_out_path)