- TW-1441 task import continues happily if filename doesn't exist.
This commit is contained in:
Paul Beckingham 2014-10-18 14:41:12 -04:00
parent 18581a6ca4
commit 5275c0ce60
10 changed files with 44 additions and 3 deletions

View file

@ -61,12 +61,15 @@ int CmdImport::execute (std::string& output)
std::vector <std::string>::iterator word;
for (word = words.begin (); word != words.end (); ++word)
{
std::string file = *word;
std::cout << format (STRING_CMD_IMPORT_FILE, file) << "\n";
File incoming (*word);
if (! incoming.exists ())
throw format (STRING_CMD_IMPORT_MISSING, *word);
std::cout << format (STRING_CMD_IMPORT_FILE, *word) << "\n";
// Load the file.
std::vector <std::string> lines;
File::read (file, lines);
incoming.read (lines);
std::vector <std::string>::iterator line;
for (line = lines.begin (); line != lines.end (); ++line)

View file

@ -460,6 +460,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Imported {1} tasks."
#define STRING_CMD_IMPORT_NOFILE "You must specify a file to import."
#define STRING_CMD_IMPORT_FILE "Importing '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "Annotation is missing a description: {1}"
#define STRING_TASK_NO_ENTRY "Annotation is missing an entry date: {1}"
#define STRING_CMD_SYNC_USAGE "Synchronizes data with the Taskserver"

View file

@ -460,6 +460,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Importis {1} taskojn."
#define STRING_CMD_IMPORT_NOFILE "Vi devas specifi kiu dosieron import."
#define STRING_CMD_IMPORT_FILE "Importanta '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "Komento havas mankon de priskribo: {1}"
#define STRING_TASK_NO_ENTRY "Komento havas mankon de enskrib-dato: {1}"
#define STRING_CMD_SYNC_USAGE "Sinkronigas datumojn kun la Taskserver"

View file

@ -468,6 +468,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Importadas {1} tareas."
#define STRING_CMD_IMPORT_NOFILE "Debe especificar un archivo a importar."
#define STRING_CMD_IMPORT_FILE "Importando '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "La anotación carece de descripción: {1}"
#define STRING_TASK_NO_ENTRY "La anotación carece de fecha de entrada: {1}"

View file

@ -459,6 +459,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Imported {1} tasks."
#define STRING_CMD_IMPORT_NOFILE "You must specify a file to import."
#define STRING_CMD_IMPORT_FILE "Importing '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "Annotation is missing a description: {1}"
#define STRING_TASK_NO_ENTRY "Annotation is missing an entry date: {1}"
#define STRING_CMD_SYNC_USAGE "Synchronizes data with the Taskserver"

View file

@ -460,6 +460,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Importati {1} task."
#define STRING_CMD_IMPORT_NOFILE "Specificare il file da importare."
#define STRING_CMD_IMPORT_FILE "Importazione di '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "Annotazione senza descrizione: {1}"
#define STRING_TASK_NO_ENTRY "Annotazione senza data di immissione: {1}"
#define STRING_CMD_SYNC_USAGE "Sincronizza i dati con il Taskserver"

View file

@ -460,6 +460,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Zaimportowano {1} zadań."
#define STRING_CMD_IMPORT_NOFILE "Musisz podać plik do zaimportowania."
#define STRING_CMD_IMPORT_FILE "Importowanie '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "Komentarz nie posiada treści: {1}"
#define STRING_TASK_NO_ENTRY "Komentarz nie posiada daty utworzenia: {1}"
#define STRING_CMD_SYNC_USAGE "Synchronizuje dane z serwerem zadań"

View file

@ -460,6 +460,7 @@
#define STRING_CMD_IMPORT_SUMMARY "Importadas {1} tarefas."
#define STRING_CMD_IMPORT_NOFILE "Necessita especificar o ficheiro a importar."
#define STRING_CMD_IMPORT_FILE "A importar '{1}'"
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
#define STRING_TASK_NO_DESC "Descrição da anotação em falta: {1}"
#define STRING_TASK_NO_ENTRY "Data de entrada da anotação em falta: {1}"
#define STRING_CMD_SYNC_USAGE "Sincroniza dados com o Taskserver"