File Browser: add an entry in the main menu
[scilab.git] / scilab / modules / ui_data / sci_gateway / cpp / sci_filebrowser.cpp
index 082d010..abb0c76 100644 (file)
@@ -17,6 +17,7 @@ extern "C"
 #include "gw_ui_data.h"
 #include "getScilabJavaVM.h"
 #include "stack-c.h"
+#include "scicurdir.h"
 }
 
 using namespace org_scilab_modules_ui_data;
@@ -24,11 +25,20 @@ using namespace org_scilab_modules_ui_data;
 /*--------------------------------------------------------------------------*/
 int sci_filebrowser(char *fname, unsigned long fname_len)
 {
+    char * cwd = NULL;
+    int err = 0;
+
     CheckRhs(0, 0);
     CheckLhs(0, 1);
 
     FileBrowser::openFileBrowser(getScilabJavaVM());
 
+    cwd = scigetcwd(&err);
+    if (cwd)
+    {
+        FileBrowser::setBaseDir(getScilabJavaVM(), cwd);
+    }
+
     LhsVar(1) = 0;
     PutLhsVar();