Fluid STR 3460: Shell Cmd would saye code to wrong path.

This commit is contained in:
Matthias Melcher
2021-12-05 23:30:41 +01:00
parent 45d1d95b57
commit ff869e7419
2 changed files with 30 additions and 8 deletions
+9
View File
@@ -370,6 +370,15 @@ static Fl_Type* write_code(Fl_Type* p) {
extern const char* header_file_name;
extern Fl_Class_Type *current_class;
/** \brief Write the source and header files for the current design.
If the files already exist, they will be overwritten.
\param[in] s filename of source code file
\param[in] t filename of the header file
\return 0 if the operation failed, 1 if it was successful
*/
int write_code(const char *s, const char *t) {
const char *filemode = "w";
if (write_sourceview)
+21 -8
View File
@@ -684,7 +684,22 @@ const char* i18n_file = "";
const char* i18n_set = "";
char i18n_program[FL_PATH_MAX] = "";
void write_cb(Fl_Widget *, void *) {
/** \brief Generate the C++ source and header filenames and write those files.
This function creates the source filename by setting the file
extension to \c code_file_name and a header filename
with the extension \c code_file_name which are both
settable by the user.
In batch_mode, the function will either be silent, or write an error message
to \c stderr and exit with exit code 1.
In interactive mode, we will pop up an error message, or, if the user
hasn't isabled that, pop up a confirmation message.
\return 1 if the operation failed, 0 if it succeeded
*/
int write_code_files() {
if (!filename) {
save_cb(0,0);
if (!filename) return;
@@ -721,6 +736,10 @@ void write_cb(Fl_Widget *, void *) {
}
}
void write_cb(Fl_Widget *, void *) {
write_code_files();
}
void write_strings_cb(Fl_Widget *, void *) {
static const char *exts[] = { ".txt", ".po", ".msg" };
if (!filename) {
@@ -1460,14 +1479,10 @@ static bool prepare_shell_command(const char * &command) { // common pre-shell
save_cb(0, 0);
}
if (shell_writecode_button->value()) {
batch_mode = 1;
write_cb(0, 0);
batch_mode = 0;
write_code_files();
}
if (shell_writemsgs_button->value()) {
batch_mode = 1;
write_strings_cb(0, 0);
batch_mode = 0;
}
return true;
}
@@ -1551,8 +1566,6 @@ void set_filename(const char *c) {
// generated for the last selected item in the header and the source
// file.
//
// Can we patent this? ;-) - Matt, mm@matthiasm.com
//
//
// Update the header and source code highlighting depending on the