]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/console_thread.cpp
- Fix ANSI labels to put EOF1 and EOF2 after each file mark.
[bacula/bacula] / bacula / src / wx-console / console_thread.cpp
index 146221e57f6852b3855ea0defdb9e5c5f77e391d..ba51097f30cf45be5e930555a99f868370b2a87b 100644 (file)
@@ -51,6 +51,16 @@ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
 
 bool console_thread::inited = false;
 bool console_thread::configloaded = false;
+wxString console_thread::working_dir = ".";
+
+void console_thread::SetWorkingDirectory(wxString w_dir) {
+   if ((w_dir.Last() == '/') || (w_dir.Last() == '\\')) {
+      console_thread::working_dir = w_dir.Mid(0, w_dir.Length()-1);
+   }
+   else {
+      console_thread::working_dir = w_dir;
+   }
+}
 
 void console_thread::InitLib() {
    if (WSA_Init() != 0) {
@@ -62,6 +72,7 @@ void console_thread::InitLib() {
    init_stack_dump();
    my_name_is(0, NULL, "wx-console");
    //textdomain("bacula-console");
+   working_directory = console_thread::working_dir;
    
    inited = true;
 }
@@ -94,11 +105,11 @@ wxString console_thread::LoadConfig(wxString configfile) {
    }
    
    init_msg(NULL, msgs);
-   init_console_msg(".");
+   init_console_msg(console_thread::working_dir);
 
    if (!parse_config(configfile.c_str(), 0)) {
       configloaded = false;
-      wxFile file("./wx-console.conmsg");
+      wxFile file(console_thread::working_dir + "/wx-console.conmsg");
       if (!file.IsOpened())
          return "Unable to retrieve error message.";
       wxString err = "";
@@ -112,12 +123,12 @@ wxString console_thread::LoadConfig(wxString configfile) {
       }
       file.Close();
       term_msg();
-      wxRemoveFile("./wx-console.conmsg");
+      wxRemoveFile(console_thread::working_dir + "/wx-console.conmsg");
       return err;
    }
    
    term_msg();
-   wxRemoveFile("./wx-console.conmsg");
+   wxRemoveFile(console_thread::working_dir + "/wx-console.conmsg");
    init_msg(NULL, NULL);
    
    configloaded = true;
@@ -260,7 +271,7 @@ void* console_thread::Entry() {
    
    csprint(NULL, CS_CONNECTED);
    
-   Write("messages\n");
+   Write(".messages\n");
 
    int stat;