Example #1
0
 def __init__(self, path, name, i):
     File_object.__init__(self, path, name, i)
     self.original_name = self.full_name
     if not self.is_mounted:
         # Extension becomes question mark if it isn't mounted
         self.full_name += self.unknown_ext
     if self.is_directory:
         # Directory gets a bit of eye candy in extension
         self.full_name += self.pydir_ext
     if self.is_link:
         # give links the behaviour of automatically take on ext
         # of target file, given the right conditions
         junk, ext = os.path.splitext(self.real_path)
         if self.ext and ext != self.ext:
             pass  # don't add its own extension
         else:
             self.full_name += ext        
     self.name, self.ext = os.path.splitext(self.full_name)
Example #2
0
 def __init__(self, path, name, i):
     """
     Detect whether name has a path built-in or not,
     if so it sets path accordingly
     """
     verbose = False
     _extra = None
     if isinstance(name, list):
         verbose and print("Using _extra")
         _extra = name[1]
         name = name[0]
     p, n = os.path.split(name)
     if p:
         File_object.__init__(self, p, n, i)
     else:
         File_object.__init__(self, path, name, i)
     self._extra = _extra
     if self._extra:
         self.str_trick = '_extra'
     verbose and print("Here is the SelectObject: {}".format(self))