def _add_folder(self, folderURI): """ Adds the folder to the db. Starts a thread to scan it in the background """ if folderURI not in self.scanThreads: name = Vfs.uri_get_filename(folderURI) oid = self.db.insert(table="config", values=(folderURI, FileDataProvider.TYPE_FOLDER, 0, False, name)) self.make_thread( folderURI, False, #include hidden False, #follow symlinks self._on_scan_folder_progress, self._on_scan_folder_completed, oid)
def _add_folder(self, folderURI): """ Adds the folder to the db. Starts a thread to scan it in the background """ if folderURI not in self.scanThreads: name = Vfs.uri_get_filename(folderURI) oid = self.db.insert( table="config", values=(folderURI,FileDataProvider.TYPE_FOLDER,0,False,name) ) self.make_thread( folderURI, False, #include hidden False, #follow symlinks self._on_scan_folder_progress, self._on_scan_folder_completed, oid )
def get_name(self): return Vfs.uri_get_filename(self.folder)
for i in localURIs: f = File.File(i) ok("Local: %s exists" % i, f.exists()) remote = f.is_local() == 1 # these might not be local, we might be on nfs after all! ok("Local: is local = %s" % remote, remote, die=False) mime = f.get_mimetype() ok("Local: file mimetype = %s" % mime, type(mime) == str and len(mime) > 0) mtime = f.get_mtime() ok("Local: file mtime = %s" % mtime, mtime != None) size = f.get_size() # the files are 5 bytes in size ok("Local: file size = %s" % size, size == 5) fname = f.get_filename() # Not a strict test because my get_filename() is a bit of a hack ok("Local: file name = %s" % fname, fname == Vfs.uri_get_filename(i)) comp = oldest.compare(older) ok("Local Compare: checking oldest < older = %s" % comp, comp == conduit.datatypes.COMPARISON_OLDER) comp = newest.compare(newer) ok("Local Compare: checking newest > newer = %s" % comp, comp == conduit.datatypes.COMPARISON_NEWER) comp = newest.compare(newest) ok("Local Compare: checking newest == newest = %s" % comp, comp == conduit.datatypes.COMPARISON_EQUAL) comp = oldest.compare(null) ok("Local Compare: checking oldest w null = %s" % comp, comp == conduit.datatypes.COMPARISON_NEWER) # test the handling of weird characters and transferring files to unusual paths tmpdir = Utils.new_tempdir() f1 = Utils.new_tempfile(Utils.random_string()) f2 = os.path.join(tmpdir, "I am", "a", "path with spaces", "foo.txt")