Changeset 3d3fb6c in git


Ignore:
Timestamp:
15/01/14 06:12:04 (6 years ago)
Author:
Olly Betts <olly@…>
Branches:
line_contents, master, stereo, travis-osx
Children:
15e50b0
Parents:
ba0f22b
Message:

lib/,src/cavernlog.cc: If we fail to start the external editor,
throw up an error box.

Files:
16 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rba0f22b r3d3fb6c  
     1Wed Jan 15 06:11:12 GMT 2014  Olly Betts <olly@survex.com>
     2
     3        * lib/,src/cavernlog.cc: If we fail to start the external editor,
     4          throw up an error box.
     5
    16Wed Jan 15 05:58:31 GMT 2014  Olly Betts <olly@survex.com>
    27
  • lib/ca.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Josep Guarro <josep@imapmail.org>\n"
    99"Language-Team: \n"
     
    121121msgstr "Hi havia %d alerta(es)."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127127#, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "No s’ha pogut obrir el “pipe”: “%s”"
    130130
  • lib/de.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Dennis Baudys <Unknown>\n"
    99"Language-Team: \n"
     
    121121msgstr "Es gab %d Warnungen."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127127#, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Pipe konnte nicht geöffnet werden: »%s«"
    130130
  • lib/de_CH.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Olly Betts <olly@survex.com>\n"
    99"Language-Team: \n"
     
    121121msgstr "Es gab %d Warnungen."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Pipe konnte nicht geöffnet werden: «%s»"
    130130
  • lib/en_US.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Olly Betts <olly@survex.com>\n"
    99"Language-Team: \n"
     
    121121msgstr "There were %d warning(s)."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127127#, c-format
    128 msgid "Couldn’t open pipe: “%s”"
    129 msgstr "Couldn’t open pipe: “%s”"
     128msgid "Couldn’t run external command: “%s”"
     129msgstr "Couldn’t run external command: “%s”"
    130130
    131131#: ../src/datain.c:80
  • lib/es.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Josep Guarro <josep@imapmail.org>\n"
    99"Language-Team: \n"
     
    121121msgstr "Havia %d alerta(s)."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "No se pudo abrir el “pipe”: “%s”"
    130130
  • lib/fr.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Eric Madelaine <eric.madelaine@inria.fr>\n"
    99"Language-Team: \n"
     
    121121msgstr "Il y a %d avertissement(s)."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Ne peut pas ouvrir le “pipe”: “%s”"
    130130
  • lib/id.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Arief Setiadi Wibowo <q_thrynx@yahoo.com>\n"
    99"Language-Team: Indonesian <id@li.org>\n"
     
    121121msgstr "Terdapat peringatan %d"
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Tidak dapat membuka pipa: “%s”"
    130130
  • lib/it.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Roberto Maugeri <zoomx@tiscalinet.it>\n"
    99"Language-Team: \n"
     
    121121msgstr "Ci sono %d avvertimenti."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Il piping non puó essere eseguito: “%s”"
    130130
  • lib/pt.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Olly Betts <olly@survex.com>\n"
    99"Language-Team: \n"
     
    121121msgstr "Há %d alerta(s)."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Impossível abrir “pipe”: “%s”"
    130130
  • lib/pt_BR.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Olly Betts <olly@survex.com>\n"
    99"Language-Team: \n"
     
    121121msgstr "Há %d alerta(s)."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Impossível abrir “pipe”: “%s”"
    130130
  • lib/ro.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Olly Betts <olly@survex.com>\n"
    99"Language-Team: \n"
     
    121121msgstr "Au fost %d avertismente."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Nu s-a putut deschide “pipe”: “%s”"
    130130
  • lib/sk.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Martin Sluka <martinsluka@mac.com>\n"
    99"Language-Team: \n"
     
    121121msgstr "Celkom bolo zaznamenaných %d varovaní."
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127 #, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     127#, c-format, fuzzy
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr "Nepodarilo sa otvoriť “pipe”: “%s”"
    130130
  • lib/survex.pot

    rba0f22b r3d3fb6c  
    123123msgstr ""
    124124
    125 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    126 #. Possibly better not to translate it.
     125#. TRANSLATORS: %s is replaced by the command we attempted to run.
     126#: ../src/cavernlog.cc:174
    127127#: ../src/cavernlog.cc:224
    128128#: n:17
    129129#, c-format
    130 msgid "Couldn’t open pipe: “%s”"
     130msgid "Couldn’t run external command: “%s”"
    131131msgstr ""
    132132
  • lib/zh_CN.po

    rba0f22b r3d3fb6c  
    55"Report-Msgid-Bugs-To: olly@survex.com\n"
    66"POT-Creation-Date: 1999-08-26 12:23:58 +0000\n"
    7 "PO-Revision-Date: 2013-10-31 12:06:19 +0000\n"
     7"PO-Revision-Date: 2014-01-15 00:39:01 +0000\n"
    88"Last-Translator: Olly Betts <olly@survex.com>\n"
    99"Language-Team: \n"
     
    121121msgstr ""
    122122
    123 #. TRANSLATORS: pipe here means a Unix pipe, which transfers data between two programs.
    124 #. Possibly better not to translate it.
     123#. TRANSLATORS: %s is replaced by the command we attempted to run.
     124#: ../src/cavernlog.cc:174
    125125#: ../src/cavernlog.cc:224
    126126#: n:17
    127127#, c-format
    128 msgid "Couldn’t open pipe: “%s”"
     128msgid "Couldn’t run external command: “%s”"
    129129msgstr ""
    130130
  • src/cavernlog.cc

    rba0f22b r3d3fb6c  
    22 * Run cavern inside an Aven window
    33 *
    4  * Copyright (C) 2005,2006,2010,2011,2012 Olly Betts
     4 * Copyright (C) 2005,2006,2010,2011,2012,2014 Olly Betts
    55 *
    66 * This program is free software; you can redistribute it and/or modify
     
    103103    wxString title = link.GetTarget();
    104104    size_t colon = href.rfind(wxT(':'));
    105     if (colon != wxString::npos) {
    106         size_t colon2 = href.rfind(wxT(':'), colon - 1);
    107         if (colon2 != wxString::npos) swap(colon, colon2);
    108 #ifdef __WXMSW__
    109         wxString cmd = wxT("notepad $f");
     105    if (colon == wxString::npos)
     106        return;
     107    size_t colon2 = href.rfind(wxT(':'), colon - 1);
     108    if (colon2 != wxString::npos) swap(colon, colon2);
     109#ifdef __WXMSW__
     110    wxString cmd = wxT("notepad $f");
    110111#elif defined __WXMAC__
    111         wxString cmd = wxT("open -t $f");
    112 #else
    113         wxString cmd = wxT("x-terminal-emulator -title $t -e vim +'call cursor($l,$c)' $f");
    114         // wxString cmd = wxT("gedit -b $f +$l:$c $f");
    115         // wxString cmd = wxT("x-terminal-emulator -title $t -e emacs +$l $f");
    116         // wxString cmd = wxT("x-terminal-emulator -title $t -e nano +$l $f");
    117         // wxString cmd = wxT("x-terminal-emulator -title $t -e jed -g $l $f");
    118 #endif
    119         const char * p = getenv("SURVEXEDITOR");
    120         if (p) {
    121             cmd = wxString(p, wxConvUTF8);
    122             if (!cmd.find(wxT("$f"))) {
    123                 cmd += wxT(" $f");
    124             }
    125         }
    126         size_t i = 0;
    127         while ((i = cmd.find(wxT('$'), i)) != wxString::npos) {
    128             if (++i >= cmd.size()) break;
    129             switch ((int)cmd[i]) {
    130                 case wxT('$'):
    131                     cmd.erase(i, 1);
    132                     break;
    133                 case wxT('f'): {
    134                     wxString f = escape_for_shell(href.substr(0, colon), true);
    135                     cmd.replace(i - 1, 2, f);
    136                     i += f.size() - 1;
    137                     break;
    138                 }
    139                 case wxT('t'): {
    140                     wxString t = escape_for_shell(title);
    141                     cmd.replace(i - 1, 2, t);
    142                     i += t.size() - 1;
    143                     break;
    144                 }
    145                 case wxT('l'): {
    146                     wxString l = escape_for_shell(href.substr(colon + 1, colon2 - colon - 1));
    147                     cmd.replace(i - 1, 2, l);
    148                     i += l.size() - 1;
    149                     break;
    150                 }
    151                 case wxT('c'): {
    152                     wxString l;
    153                     if (colon2 == wxString::npos)
    154                         l = wxT("0");
    155                     else
    156                         l = escape_for_shell(href.substr(colon2 + 1));
    157                     cmd.replace(i - 1, 2, l);
    158                     i += l.size() - 1;
    159                     break;
    160                 }
    161                 default:
    162                     ++i;
    163             }
    164         }
    165 #ifdef __WXMSW__
    166         _wsystem(cmd.c_str());
    167 #else
    168         system(cmd.mb_str());
    169 #endif
    170     }
     112    wxString cmd = wxT("open -t $f");
     113#else
     114    wxString cmd = wxT("x-terminal-emulator -title $t -e vim +'call cursor($l,$c)' $f");
     115    // wxString cmd = wxT("gedit -b $f +$l:$c $f");
     116    // wxString cmd = wxT("x-terminal-emulator -title $t -e emacs +$l $f");
     117    // wxString cmd = wxT("x-terminal-emulator -title $t -e nano +$l $f");
     118    // wxString cmd = wxT("x-terminal-emulator -title $t -e jed -g $l $f");
     119#endif
     120    const char * p = getenv("SURVEXEDITOR");
     121    if (p) {
     122        cmd = wxString(p, wxConvUTF8);
     123        if (!cmd.find(wxT("$f"))) {
     124            cmd += wxT(" $f");
     125        }
     126    }
     127    size_t i = 0;
     128    while ((i = cmd.find(wxT('$'), i)) != wxString::npos) {
     129        if (++i >= cmd.size()) break;
     130        switch ((int)cmd[i]) {
     131            case wxT('$'):
     132                cmd.erase(i, 1);
     133                break;
     134            case wxT('f'): {
     135                wxString f = escape_for_shell(href.substr(0, colon), true);
     136                cmd.replace(i - 1, 2, f);
     137                i += f.size() - 1;
     138                break;
     139            }
     140            case wxT('t'): {
     141                wxString t = escape_for_shell(title);
     142                cmd.replace(i - 1, 2, t);
     143                i += t.size() - 1;
     144                break;
     145            }
     146            case wxT('l'): {
     147                wxString l = escape_for_shell(href.substr(colon + 1, colon2 - colon - 1));
     148                cmd.replace(i - 1, 2, l);
     149                i += l.size() - 1;
     150                break;
     151            }
     152            case wxT('c'): {
     153                wxString l;
     154                if (colon2 == wxString::npos)
     155                    l = wxT("0");
     156                else
     157                    l = escape_for_shell(href.substr(colon2 + 1));
     158                cmd.replace(i - 1, 2, l);
     159                i += l.size() - 1;
     160                break;
     161            }
     162            default:
     163                ++i;
     164        }
     165    }
     166#ifdef __WXMSW__
     167    if (_wsystem(cmd.c_str()) >= 0)
     168        return;
     169#else
     170    if (system(cmd.mb_str()) >= 0)
     171        return;
     172#endif
     173    wxString m;
     174    m.Printf(wmsg(/*Couldn’t run external command: “%s”*/17), cmd.c_str());
     175    m += wxT(" (");
     176    m += wxString(strerror(errno), wxConvUTF8);
     177    m += wxT(')');
     178    wxGetApp().ReportError(m);
    171179}
    172180
     
    222230    if (!cavern_out) {
    223231        wxString m;
    224         m.Printf(wmsg(/*Couldn’t open pipe: “%s”*/17), cmd.c_str());
     232        m.Printf(wmsg(/*Couldn’t run external command: “%s”*/17), cmd.c_str());
    225233        m += wxT(" (");
    226234        m += wxString(strerror(errno), wxConvUTF8);
Note: See TracChangeset for help on using the changeset viewer.