source: trunk/WINDOW/AW_edit.cxx

Last change on this file was 16763, checked in by westram, 7 years ago
File size: 1.5 KB
Line 
1// ================================================================ //
2//                                                                  //
3//   File      : AW_edit.cxx                                        //
4//   Purpose   :                                                    //
5//                                                                  //
6//   Institute of Microbiology (Technical University Munich)        //
7//   http://www.arb-home.de/                                        //
8//                                                                  //
9// ================================================================ //
10
11#include "aw_edit.hxx"
12#include "aw_msg.hxx"
13
14#include <arb_msg.h>
15
16void AW_edit(const char *path) {
17    // Start external editor on file 'path' (asynchronously)
18    //
19    // Note: no longer use ARB_TEXTEDIT directly -> now completely delegates logic to script ../SH/arb_textedit
20
21    arb_assert(!strchr(path, '$')); // AW_edit previously supported expansion of environment variables (please perform at caller where needed!)
22
23    char *quotedFile = GBK_singlequote(path);
24    char *command    = GBS_global_string_copy("arb_textedit %s &", quotedFile);
25
26    GB_ERROR error = GBK_system(command);
27    aw_message_if(error);
28
29    free(command);
30    free(quotedFile);
31}
32
33void AW_edit_notified(const char *path, const FileChangedCallback& callback) {
34    // like AW_edit, but also installs a callback called whenever file is changed.
35    // The callback remains active forever.
36
37    AW_edit(path);
38    AW_add_inotification(path, callback);
39}
40
Note: See TracBrowser for help on using the repository browser.