# Post-installation script for Windows.

import os
import sys
import shutil

install_message = """

PyWord has been installed on your system.  You can run it by
double-clicking the MyWord icon on your desktop.

"""

if sys.platform == 'win32':
    join = os.path.join

    title = "What's My Word"
    program = module = "myword"

    # Various pathnames.
    scriptdir = join(sys.prefix, "Scripts")
    libdir = join(sys.prefix, "Lib")
    datadir = join(libdir, "site-packages", module)
    deskdir = get_special_folder_path("CSIDL_COMMON_DESKTOPDIRECTORY")

    if "HOME" in os.environ:
        startdir = os.environ["HOME"]
    else:
        startdir = deskdir

    # Installed files.
    exefile = join(scriptdir, "%s.exe" % program)
    iconfile = join(datadir, "%s.ico" % program)
    linkfile = join(deskdir, "%s.lnk" % title)

    if sys.argv[1] == '-install':
        # Add shortcut to desktop.
        if not os.path.exists(linkfile):
            create_shortcut(exefile, title, linkfile, "",
                            startdir, iconfile)

            file_created(linkfile)

        print install_message

# Local Variables:
# mode: python
# End:
