# Path: kano_profile/paths.py
# TRACKER_UUIDS_PATH = os.path.join(kanoprofile_dir, 'tracker', 'uuids')
# PAUSED_SESSIONS_FILE = os.path.join(kanoprofile_dir, '.paused_sessions')


import json
import os
from kano.utils import read_json, write_json, get_date_now, ensure_dir, \
    chown_path, run_print_output_error, run_bg, run_cmd
from kano.logging import logger
from kano_profile.paths import apps_dir, xp_file, kanoprofile_dir, \
    app_profiles_file
    from kano.utils.misc import is_installed
    from kano.utils.shell import run_cmd
        "'{}' not installed will attempt to install it as '{}' using kano apps"
        .format(app, debpkg_to_kano_appstore[app])
    )
    cmd = cmd_template.format(app_name=debpkg_to_kano_appstore[app])
    run_cmd(cmd)

    # Check whether it has been installed
    if not is_installed(app):
        # Something probably went wrong here
        logger.error(
            "Attempted to install app '{}' but something went wrong"
            .format(app)
        )
        return False

    return True


def launch_project(app, filename, data_dir, background=False):
    # This is necessary to support the new official names
    # TODO: once the apps have been renamed this will not be necessary
    name_translation = {
        'make-art': 'kano-draw',
        'terminal-quest': 'linux-story'
    }

    app_tr = name_translation.get(app, app)

    logger.info("launch_project: {} {} {}".format(app_tr, filename, data_dir))


# Path: kano_profile/paths.py
# TRACKER_UUIDS_PATH = os.path.join(kanoprofile_dir, 'tracker', 'uuids')
# PAUSED_SESSIONS_FILE = os.path.join(kanoprofile_dir, '.paused_sessions')


# Path: kano_profile/apps.py
import json
import os
from kano.utils import read_json, write_json, get_date_now, ensure_dir, \
    chown_path, run_print_output_error, run_bg, run_cmd
from kano.logging import logger
from kano_profile.paths import apps_dir, xp_file, kanoprofile_dir, \
    app_profiles_file
    from kano.utils.misc import is_installed
    from kano.utils.shell import run_cmd

        "'{}' not installed will attempt to install it as '{}' using kano apps"
        .format(app, debpkg_to_kano_appstore[app])
    )
    cmd = cmd_template.format(app_name=debpkg_to_kano_appstore[app])
    run_cmd(cmd)

    # Check whether it has been installed
    if not is_installed(app):
        # Something probably went wrong here
        logger.error(
            "Attempted to install app '{}' but something went wrong"
            .format(app)
        )
        return False

    return True


def launch_project(app, filename, data_dir, background=False):
    # This is necessary to support the new official names
    # TODO: once the apps have been renamed this will not be necessary
    name_translation = {
        'make-art': 'kano-draw',
        'terminal-quest': 'linux-story'
    }

    app_tr = name_translation.get(app, app)

    logger.info("launch_project: {} {} {}".format(app_tr, filename, data_dir))


    app_profiles = read_json(app_profiles_file)