def on_done(self, paths, relative_to_project, name): if relative_to_project and s.get('new_files_relative_to_project_root'): paths = SideBarProject().getDirectories() if paths: paths = [SideBarItem(paths[0], False)] if not paths: paths = SideBarSelection(paths).getSelectedDirectoriesOrDirnames() else: paths = SideBarSelection(paths).getSelectedDirectoriesOrDirnames() if not paths: paths = SideBarProject().getDirectories() if paths: paths = [SideBarItem(paths[0], False)] if not paths: sublime.active_window().new_file() else: for item in paths: item = SideBarItem(item.join(name), False) if item.exists(): sublime.error_message("Unable to create file, file or folder exists.") self.run(paths, name) return else: try: item.create() item.edit() except: sublime.error_message("Unable to create file:\n\n"+item.path()) self.run(paths, name) return SideBarProject().refresh();
def on_done(self, paths, name): for folder_item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames(): folder_item = SideBarItem(folder_item.join(name), True) if folder_item.exists(): sublime.error_message("Unable to create folder, folder or file exists.") self.run(paths, name) return else: try: folder_item.create() init_item = SideBarItem(folder_item.join('__init__.py'), False) init_item.create() except: sublime.error_message("Unable to create file:\n\n" + init_item.path()) self.run(paths, name) return if not folder_item.exists(): sublime.error_message("Unable to create folder:\n\n" + folder_item.path()) self.run(paths, name) return SideBarProject().refresh()
def on_done(self, paths, name): for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames(): item = SideBarItem(item.join(name), True) if item.exists(): sublime.error_message("Unable to create folder, folder or file exists.") self.run(paths, name) return else: item.create() if not item.exists(): sublime.error_message("Unable to create folder:\n\n"+item.path()) self.run(paths, name) return SideBarProject().refresh();
def on_done(self, paths, name): for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames(): item = SideBarItem(item.join(name), False) if item.exists(): sublime.error_message("Unable to create file, file or folder exists.") self.run(paths, name) return else: try: item.create() item.edit() except: sublime.error_message("Unable to create file:\n\n"+item.path()) self.run(paths, name) return SideBarProject().refresh();
def on_done(self, paths, name): for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames(): item = SideBarItem(item.join(name), False) if item.exists(): sublime.error_message( "Unable to create file, file or folder exists.") self.run(paths, name) return else: try: item.create() item.edit() except: sublime.error_message("Unable to create file:\n\n" + item.path()) self.run(paths, name) return SideBarProject().refresh()