Esempio n. 1
0
    def do_paste(self, path):

        # Reset FileNavigatorCommand
        self.cls.reset()

        # Load settings
        s = sublime.load_settings("File Navigator.sublime-settings")
        cache_timeout = s.get("cache_timeout", 24)

        # add history_items
        items = history_items()
        items += [{"path": path, "rtime": int(time.time())}]

        # Add history items
        s = sublime.load_settings("File Navigator.history")
        s.set("items", items)
        sublime.save_settings("File Navigator.history")

        for item in self.item_buffer:
            try:
                if item["type"] == "move":
                    shutil.move(item["file_path"],
                                os.path.join(path, item["file_name"]))
                elif item["type"] == "copy":
                    if os.path.isdir(item["file_path"]):
                        shutil.copytree(item["file_path"],
                                        os.path.join(path, item["file_name"]))
                    else:
                        shutil.copy(item["file_path"],
                                    os.path.join(path, item["file_name"]))
            except Exception as e:
                pass

        sublime.status_message("%d paste in %s" %
                               (len(self.item_buffer), path))
	def do_paste(self, path):

		# Reset FileNavigatorCommand
		self.cls.reset()

		# Load settings
		s = sublime.load_settings("File Navigator.sublime-settings")
		cache_timeout = s.get("cache_timeout", 24)

		# add history_items
		items = history_items()
		items += [{"path": path, "rtime": int(time.time())}]

		# Add history items
		s = sublime.load_settings("File Navigator.history")
		s.set("items", items)
		sublime.save_settings("File Navigator.history")

		for item in self.item_buffer:
			try:
				if item["type"] == "move":
					shutil.move(item["file_path"], os.path.join(path, item["file_name"]))
				elif item["type"] == "copy":
					if os.path.isdir(item["file_path"]):
						shutil.copytree(item["file_path"], os.path.join(path, item["file_name"]))
					else:
						shutil.copy(item["file_path"], os.path.join(path, item["file_name"]))
			except Exception as e:
				pass

		sublime.status_message("%d paste in %s" % (len(self.item_buffer), path))
	def do_copy(self, path):
		roots = self.find_root()

		# add history_items
		roots += [item["path"] for item in history_items()]

		self.item_buffer = [{"file_path": path, "file_name": os.path.basename(path), "type": "copy"}]
		self.choose_root(list(set(roots)))
Esempio n. 4
0
    def do_copy(self, path):
        roots = self.find_root()

        # add history_items
        roots += [item["path"] for item in history_items()]

        self.item_buffer = [{
            "file_path": path,
            "file_name": os.path.basename(path),
            "type": "copy"
        }]
        self.choose_root(list(set(roots)))