from . import NoteBaseCommand import os from datetime import timedelta import sublime import sublime_plugin class NewNoteForTomorrowCommand(NoteBaseCommand, sublime_plugin.WindowCommand): def run(self): self.date = self.get_date() + timedelta(days=1) notes_path = self.get_notes_path(self.window.project_data()) if notes_path: year, month = self.get_date_parts() directory = os.path.join(notes_path, year, month) os.makedirs(directory, exist_ok=True) file_path = os.path.join(directory, self.file_name()) # Check if file already exists if os.path.exists(file_path): sublime.message_dialog(f"The file '{self.file_name()}' already exists.") else: self.write_file_heading(file_path) else: sublime.message_dialog("No 'Notes' directory found in the project. Please add a 'Notes' folder.")