def isFile(self): """ The tar file impl. doesn't follow sym links to check file types """ try: ti=TarUtils.getTarInfo(self.__tarFilePath,self.__tarPath) while ti.issym(): ti=TarUtils.getTarInfo(self.__tarFilePath,ti.linkname) return ti.isfile() except ufsi.PathNotFoundError,e: return False
def isFile(self): """ The tar file impl. doesn't follow sym links to check file types """ try: ti = TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath) while ti.issym(): ti = TarUtils.getTarInfo(self.__tarFilePath, ti.linkname) return ti.isfile() except ufsi.PathNotFoundError, e: return False
def isDir(self): """ Dirs must end in a slash char The tar file impl. doesn't follow sym links to check file types TODO: A symlink to a dir doesn't have a trailing slash. """ try: dirPath = self.__tarPath if not dirPath.endswith(self.getSeparator()): dirPath += self.getSeparator() ti = TarUtils.getTarInfo(self.__tarFilePath, dirPath) while ti.issym(): ti = TarUtils.getTarInfo(self.__tarFilePath, ti.linkname) return ti.isdir() except ufsi.PathNotFoundError, e: return False
def getSymlinkPath(self): """ """ if not self.isSymlink(): raise ufsi.NotASymlinkError('%r is not a symlink' % self.__tarPath) return ufsi.Path( TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).linkname)
def isSymlink(self): """ """ try: return TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).issym() except ufsi.PathNotFoundError, e: return False
def isDir(self): """ Dirs must end in a slash char The tar file impl. doesn't follow sym links to check file types TODO: A symlink to a dir doesn't have a trailing slash. """ try: dirPath=self.__tarPath if not dirPath.endswith(self.getSeparator()): dirPath+=self.getSeparator() ti=TarUtils.getTarInfo(self.__tarFilePath,dirPath) while ti.issym(): ti=TarUtils.getTarInfo(self.__tarFilePath,ti.linkname) return ti.isdir() except ufsi.PathNotFoundError,e: return False
def getSymlinkPath(self): """ """ if not self.isSymlink(): raise ufsi.NotASymlinkError('%r is not a symlink'%self.__tarPath) return ufsi.Path(TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).linkname)
def isSymlink(self): """ """ try: return TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).issym() except ufsi.PathNotFoundError,e: return False
def getStat(self): ti = TarUtils.getTarInfo(self.__path.getTarFilePath(), self.__tarPathStr) return TarUtils.tarInfoToDict(ti)
def getStat(self): ti=TarUtils.getTarInfo(self.__path.getTarFilePath(),self.__tarPathStr) return TarUtils.tarInfoToDict(ti)