diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 8224b409b..2a4b71138 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -756,7 +756,7 @@ CmdEdit::editResult CmdEdit::editFile (Task& task) // Create a temp file name in data.location. std::stringstream file; - file << "task." << getpid () << "." << task.id << ".task"; + file << "task." << task.get ("uuid").substr (0, 8) << ".task"; // Determine the output date format, which uses a hierarchy of definitions. // rc.dateformat.edit @@ -770,6 +770,11 @@ CmdEdit::editResult CmdEdit::editFile (Task& task) int ignored = chdir (location._data.c_str ()); ++ignored; // Keep compiler quiet. + // Check if the file already exists, if so, bail out + Path filepath = Path (file.str ()); + if (filepath.exists ()) + throw std::string (STRING_EDIT_IN_PROGRESS); + // Format the contents, T -> text, write to a file. std::string before = formatTask (task, dateformat); std::string before_orig = before; diff --git a/src/l10n/deu-DEU.h b/src/l10n/deu-DEU.h index dfa04d12b..3c582f14b 100644 --- a/src/l10n/deu-DEU.h +++ b/src/l10n/deu-DEU.h @@ -671,6 +671,7 @@ #define STRING_EDIT_NO_CHANGES "Keine Änderungen entdeckt." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Bearbeitung abgeschlossen." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Starte jetzt '{1}'..." #define STRING_EDIT_CHANGES "Änderungen entdeckt." #define STRING_EDIT_UNPARSEABLE "Taskwarrior konnte Ihre Änderungen nicht verarbeiten. Möchten Sie es erneut probieren?" diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index 0d6b9017e..2e45d0a82 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -669,6 +669,7 @@ #define STRING_EDIT_NO_CHANGES "No edits were detected." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Editing complete." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Launching '{1}' now..." #define STRING_EDIT_CHANGES "Edits were detected." #define STRING_EDIT_UNPARSEABLE "Taskwarrior couldn't handle your edits. Would you like to try again?" diff --git a/src/l10n/epo-RUS.h b/src/l10n/epo-RUS.h index 40c6275d5..9f95801a2 100644 --- a/src/l10n/epo-RUS.h +++ b/src/l10n/epo-RUS.h @@ -671,6 +671,7 @@ #define STRING_EDIT_NO_CHANGES "Ne detektis nenian redakton." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Redaktis komplete." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Lanĉanta nun '{1}'..." #define STRING_EDIT_CHANGES "Detektis redaktojn." #define STRING_EDIT_UNPARSEABLE "Taskwarrior ne povis trakti viaj redaktojn. Ĉu vi volas ripovi?" diff --git a/src/l10n/esp-ESP.h b/src/l10n/esp-ESP.h index 4673c713c..6a8542e69 100644 --- a/src/l10n/esp-ESP.h +++ b/src/l10n/esp-ESP.h @@ -683,6 +683,7 @@ #define STRING_EDIT_NO_CHANGES "No se detectaron modificaciones." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Edición completada." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Lanzando '{1}' ahora..." #define STRING_EDIT_CHANGES "Se detectaron modificaciones." #define STRING_EDIT_UNPARSEABLE "Taskwarrior no pudo manejar sus modificaciones. ¿Quiere intentarlo de nuevo?" diff --git a/src/l10n/fra-FRA.h b/src/l10n/fra-FRA.h index 74b4d1c51..91900812b 100644 --- a/src/l10n/fra-FRA.h +++ b/src/l10n/fra-FRA.h @@ -671,6 +671,7 @@ #define STRING_EDIT_NO_CHANGES "Aucunes modifications détectées." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Édition terminée." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Lancement de '{1}' maintenant..." #define STRING_EDIT_CHANGES "Des modifications ont été détectées." #define STRING_EDIT_UNPARSEABLE "Taskwarrior n'a pas pu appliquer vos modifications. Désirez-vous essayer à nouveau ?" diff --git a/src/l10n/ita-ITA.h b/src/l10n/ita-ITA.h index 5269b26af..a662ef547 100644 --- a/src/l10n/ita-ITA.h +++ b/src/l10n/ita-ITA.h @@ -670,6 +670,7 @@ #define STRING_EDIT_NO_CHANGES "Nessuna modifica riscontrata." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Modifica completa." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Esecuzione di '{1}' ora..." #define STRING_EDIT_CHANGES "Modifiche rilevate." #define STRING_EDIT_UNPARSEABLE "Taskwarrior non può gestire le modifiche. Provare di nuovo?" diff --git a/src/l10n/jpn-JPN.h b/src/l10n/jpn-JPN.h index 2cffa5e4e..a240fe6f6 100644 --- a/src/l10n/jpn-JPN.h +++ b/src/l10n/jpn-JPN.h @@ -671,6 +671,7 @@ #define STRING_EDIT_NO_CHANGES "No edits were detected." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Editing complete." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Launching '{1}' now..." #define STRING_EDIT_CHANGES "Edits were detected." #define STRING_EDIT_UNPARSEABLE "Taskwarrior couldn't handle your edits. Would you like to try again?" diff --git a/src/l10n/pol-POL.h b/src/l10n/pol-POL.h index a5d7afe4e..033981c34 100644 --- a/src/l10n/pol-POL.h +++ b/src/l10n/pol-POL.h @@ -671,6 +671,7 @@ #define STRING_EDIT_NO_CHANGES "Nie znaleziono żadnych edycji." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Edycja zakończona." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "Uruchamianie '{1}'..." #define STRING_EDIT_CHANGES "Zmiany wykryte." #define STRING_EDIT_UNPARSEABLE "Taskwarrior nie może wprowadzić twoich zmian. Czy chcesz spróbować jeszcze raz?" diff --git a/src/l10n/por-PRT.h b/src/l10n/por-PRT.h index bd86020af..13c7f0765 100644 --- a/src/l10n/por-PRT.h +++ b/src/l10n/por-PRT.h @@ -671,6 +671,7 @@ #define STRING_EDIT_NO_CHANGES "Não foram detetadas alterações." #define STRING_EDIT_FAILED "Editing failed with exit code {1}." #define STRING_EDIT_COMPLETE "Edição concluída." +#define STRING_EDIT_IN_PROGRESS "Task is already being edited." #define STRING_EDIT_LAUNCHING "A iniciar '{1}' ..." #define STRING_EDIT_CHANGES "Alterações detetadas." #define STRING_EDIT_UNPARSEABLE "O taskwarrior não conseguiu processar as suas alterações. Deseja tentar novamente?"