Ejemplo n.º 1
0
    def __init__(self, rootpath=None, outputfile=None, size=None, tree=None, configuration=None) :
        self._configuration = configuration
        if self._configuration == None :
            self._configuration = Configuration()

        if rootpath == None and self._configuration.get_value('path') != '' :
            rootpath = self._configuration.get_value('path')

        # Gruik Gruik : C:" -> C:\ Thanks Windows !
        if rootpath and (len(rootpath)==3) and (rootpath[2]) == '"' :
            rootpath = rootpath[0:2] + '\\'
        if (rootpath == None) and (tree==None) :
            rootpath = '.'
        if rootpath != None :
            if os.path.supports_unicode_filenames :
                rootpath = unicode(rootpath)
            else :
                rootpath = str(rootpath)
            tree = FileTree(rootpath)
            tree.scan()

        self._rootpath = rootpath
        self._tree = tree
        filename = outputfile
        if filename == None :
            filename = self._configuration.get_value('outputfile')
        if filename == '' :
            if os.path.isdir(rootpath) :
                filename = os.path.join(rootpath,self._configuration.get_value('basename')+self.EXT)
            else :
                name = os.path.split(rootpath)[1]
                filename = name + '.' + self._configuration.get_value('basename') + self.EXT
        self._filename = filename
        self._size = size
Ejemplo n.º 2
0
    def __init__(self, rootpath=None, outputfile=None, size=None, tree=None, configuration=None):
        self._configuration = configuration
        if self._configuration == None:
            self._configuration = Configuration()

        if rootpath == None and self._configuration.get_value("path") != "":
            rootpath = self._configuration.get_value("path")

        # Gruik Gruik : C:" -> C:\ Thanks Windows !
        if rootpath and (len(rootpath) == 3) and (rootpath[2]) == '"':
            rootpath = rootpath[0:2] + "\\"
        if (rootpath == None) and (tree == None):
            rootpath = "."
        if rootpath != None:
            if os.path.supports_unicode_filenames:
                rootpath = unicode(rootpath)
            else:
                rootpath = str(rootpath)
            tree = FileTree(rootpath)
            tree.scan()

        self._rootpath = rootpath
        self._tree = tree
        filename = outputfile
        if filename == None:
            filename = self._configuration.get_value("outputfile")
        if filename == "":
            if os.path.isdir(rootpath):
                filename = os.path.join(rootpath, self._configuration.get_value("basename") + self.EXT)
            else:
                name = os.path.split(rootpath)[1]
                filename = name + "." + self._configuration.get_value("basename") + self.EXT
        self._filename = filename
        self._size = size
Ejemplo n.º 3
0
    def __init__(self, rootpath=None, outputfile=None, size=None, tree=None) :
        # Gruik Gruik : C:" -> C:\ Thanks Windows !
        if rootpath and (len(rootpath)==3) and (rootpath[2]) == '"' :
            rootpath = rootpath[0:2] + '\\'
        if (rootpath == None) and (tree==None) :
            rootpath = u'.'
        if rootpath != None :
            tree = FileTree(unicode(rootpath))
            tree.scan()

        self._tree=tree
        filename = outputfile
        if filename == None :
            if os.path.isdir(rootpath) :
                filename = os.path.join(rootpath,'dirstat'+self.EXT)
            else :
                name = os.path.split(rootpath)[1]
                filename = name + '.dirstat' + self.EXT
        self._filename = filename
        self._size = size
Ejemplo n.º 4
0
    def __init__(self, rootpath=None, outputfile=None, size=None, tree=None):
        # Gruik Gruik : C:" -> C:\ Thanks Windows !
        if rootpath and (len(rootpath) == 3) and (rootpath[2]) == '"':
            rootpath = rootpath[0:2] + '\\'
        if (rootpath == None) and (tree == None):
            rootpath = u'.'
        if rootpath != None:
            tree = FileTree(unicode(rootpath))
            tree.scan()

        self._tree = tree
        filename = outputfile
        if filename == None:
            if os.path.isdir(rootpath):
                filename = os.path.join(rootpath, 'dirstat' + self.EXT)
            else:
                name = os.path.split(rootpath)[1]
                filename = name + '.dirstat' + self.EXT
        self._filename = filename
        self._size = size