File: volume_of_impl.py

package info (click to toggle)
trash-cli 0.24.5.26-0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,972 kB
  • sloc: python: 9,789; sh: 121; makefile: 11
file content (17 lines) | stat: -rw-r--r-- 431 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os

from trashcli.fstab.volume_of import VolumeOf


class VolumeOfImpl(VolumeOf):
    def __init__(self, ismount, abspath):
        self.ismount = ismount
        self.abspath = abspath

    def volume_of(self, path):
        path = self.abspath(path)
        while path != os.path.dirname(path):
            if self.ismount.is_mount(path):
                break
            path = os.path.dirname(path)
        return path