def dos2unix(fileName):
    """called during reformant_ntfs.py."""

    commandPath = '/usr/bin/dos2unix'
    if not os.path.exists(commandPath):
        dsh_utils.give_bad_news("ryw_linux.dos2unix: dos2unix doesn't exist. " +
                          "should fix this: apt-get install tofrodos.",
                          logging.error)
        return False

    command = commandPath + ' ' + fileName
    ret = subprocess.call(command, shell=True)

    if ret != 0:
        dsh_utils.give_bad_news(
            'ryw_linux.dos2unix: error in running dos2unix: ' +
            fileName, logging.error)
        return False
    else:
        dsh_utils.db_print_info_browser(
            'ryw_linux.dos2unix: dos2unix success: ' +
            fileName, 69)

    return True
def launch_explorer(path):
    """from explorer.launchExplorer()"""

    #
    # If I don't redirect stdout and stderr,
    # this stuff gets sent to the browser window.
    #
    pair = stdio_logs_open()
    if pair:
        stdout = pair[0]
        stderr = pair[1]
    else:
        stdout = None
        stderr = None


    if os.path.exists('/usr/local/bin/rox'):
        dsh_utils.db_print_info_browser('launch_explorer: found rox.', 91)
        command = '/usr/local/bin/rox '
    elif os.path.exists('/usr/bin/thunar'):
        dsh_utils.db_print_info_browser('launch_explorer: found thunar.', 91)
        command = '/usr/bin/thunar --display :0.0 '
    else:
        dsh_utils.give_bad_news("launch_explorer: can't find an explorer.",
                          logging.error)
        return False
        
    command = command + path + ' &'
    dsh_utils.db_print_info_browser(
        'launch_explorer: command is: ' + command, 91)
    ret = subprocess.call(command, shell=True, stdout=stdout, stderr=stderr,
                          env={'DISPLAY':':0.0'})

    stdio_logs_close(pair)
    
    if ret != 0:
        dsh_utils.give_bad_news('launch_explorer: error in launching explorer.',
                          logging.error)
        return False
    return True