Exemplo n.º 1
0
def removefromFavs(name, mode,isFolder):
    index = favs_index(name, mode,isFolder)
    print index
    if index >= 0:
        content = filehelpers.read_from_file(FAVOURITES_FILE)
        lines = content.split('\n')
        lines.pop(index)
        s = ''
        for line in lines:
            if len(line) > 0:
                s = s + line + '\n'
        
        if len(s) == 0:
            os.remove(FAVOURITES_FILE)
        else:
            filehelpers.write_to_file(FAVOURITES_FILE, s)
Exemplo n.º 2
0
def removefromFavs(name, mode, isFolder):
    index = favs_index(name, mode, isFolder)
    print index
    if index >= 0:
        content = filehelpers.read_from_file(FAVOURITES_FILE)
        lines = content.split('\n')
        lines.pop(index)
        s = ''
        for line in lines:
            if len(line) > 0:
                s = s + line + '\n'

        if len(s) == 0:
            os.remove(FAVOURITES_FILE)
        else:
            filehelpers.write_to_file(FAVOURITES_FILE, s)
Exemplo n.º 3
0
def addtoFavs(name, mode,isFolder):
    if favs_index(name, mode, isFolder) >= 0:
        return
    content = str(name) + '\t' + str(mode) + '\t' + str(isFolder) + '\n'
    filehelpers.write_to_file(FAVOURITES_FILE, content, append=True)
Exemplo n.º 4
0
def addtoFavs(name, mode, isFolder):
    if favs_index(name, mode, isFolder) >= 0:
        return
    content = str(name) + '\t' + str(mode) + '\t' + str(isFolder) + '\n'
    filehelpers.write_to_file(FAVOURITES_FILE, content, append=True)