コード例 #1
0
ファイル: sync.py プロジェクト: antonis-m/synnefo
    def current_hash(self, path):
        """Return the hash of the file as it exists now in the filesystem"""

        fullpath = join(self.syncdir, path)
        if fullpath in self.deleted_dirs:
            return 'DEL'
        if not exists(fullpath):
            return 'DEL'
        if isdir(fullpath):
            return 'DIR'
        return merkle(fullpath)
コード例 #2
0
ファイル: sync.py プロジェクト: kins299/mycloud
    def current_hash(self, path):
        """Return the hash of the file as it exists now in the filesystem"""

        fullpath = join(self.syncdir, path)
        if fullpath in self.deleted_dirs:
            return 'DEL'
        if not exists(fullpath):
            return 'DEL'
        if isdir(fullpath):
            return 'DIR'
        return merkle(fullpath)
コード例 #3
0
ファイル: sync.py プロジェクト: antonis-m/synnefo
    def trash(self, path):
        """Move a file to trash or delete it if it's a directory"""

        fullpath = join(self.syncdir, path)
        if not exists(fullpath):
            return

        if isfile(fullpath):
            hash = merkle(fullpath)
            trashpath = join(self.trashdir, hash)
            os.rename(fullpath, trashpath)
        else:
            self.rmdir(path)
コード例 #4
0
ファイル: sync.py プロジェクト: kins299/mycloud
    def trash(self, path):
        """Move a file to trash or delete it if it's a directory"""

        fullpath = join(self.syncdir, path)
        if not exists(fullpath):
            return

        if isfile(fullpath):
            hash = merkle(fullpath)
            trashpath = join(self.trashdir, hash)
            os.rename(fullpath, trashpath)
        else:
            self.rmdir(path)