示例#1
0
def get_old_incomplete_data_dir():
    return decode_from_filesystem(platform.get_old_incomplete_data_dir())
示例#2
0
    if config.has_key('launch_on_startup'):
        enforce_shortcut(config, log_func=sys.stderr.write)

    if os.name == 'nt' and config.has_key('enforce_association'):
        enforce_association()

    if config.has_key('save_in') and config['save_in'] == '' and \
       (not config.has_key("save_as") or config['save_as'] == '' ) \
       and uiname != 'bittorrent':
        config['save_in'] = decode_from_filesystem(get_save_dir())

    incomplete = decode_from_filesystem(get_incomplete_data_dir())
    if config.get('save_incomplete_in') == '':
        config['save_incomplete_in'] = incomplete
    if config.get('save_incomplete_in') == get_old_incomplete_data_dir():
        config['save_incomplete_in'] = incomplete

    if uiname == "test-client" or (uiname.startswith("bittorrent")
                                   and uiname != 'bittorrent-tracker'):
        if not config.get('ask_for_save'):
            # we check for existance, so things like "D:\" don't trip us up.
            if (config['save_in'] and
                not os.path.exists(config['save_in'])):
                try:
                    os.makedirs(config['save_in'])
                except OSError, e:
                    if (e.errno == 2 or # no such file or directory
                        e.errno == 13): # permission denied
                        traceback.print_exc()
                        print >> sys.stderr, "save_in could not be created. Falling back to prompting."
示例#3
0
def get_old_incomplete_data_dir():
  return decode_from_filesystem(platform.get_old_incomplete_data_dir())
    if os.name == "nt" and config.has_key("enforce_association"):
        enforce_association()

    if (
        config.has_key("save_in")
        and config["save_in"] == ""
        and (not config.has_key("save_as") or config["save_as"] == "")
        and uiname != "bittorrent"
    ):
        config["save_in"] = decode_from_filesystem(get_save_dir())

    incomplete = decode_from_filesystem(get_incomplete_data_dir())
    if config.get("save_incomplete_in") == "":
        config["save_incomplete_in"] = incomplete
    if config.get("save_incomplete_in") == get_old_incomplete_data_dir():
        config["save_incomplete_in"] = incomplete

    if uiname == "test-client" or (uiname.startswith("bittorrent") and uiname != "bittorrent-tracker"):
        if not config.get("ask_for_save"):
            # we check for existance, so things like "D:\" don't trip us up.
            if config["save_in"] and not os.path.exists(config["save_in"]):
                try:
                    os.makedirs(config["save_in"])
                except OSError, e:
                    if e.errno == 2 or e.errno == 13:  # no such file or directory  # permission denied
                        traceback.print_exc()
                        print >> sys.stderr, "save_in could not be created. Falling back to prompting."
                        config["ask_for_save"] = True
                    elif e.errno != 17:  # path already exists
                        raise