Fix for project saving

git-svn-id: svn://svn.savannah.nongnu.org/lash/trunk@21 1de19dc7-4e3f-0410-a61d-eddf686bf0b7
This commit is contained in:
Dave Robillard 2006-02-09 19:04:51 +00:00
parent 3d031ca42b
commit f4460b3cca
2 changed files with 8 additions and 15 deletions

View File

@ -20,6 +20,7 @@
#include <malloc.h>
#include <lash/lash.h>
#include <assert.h>
#include <unistd.h>
/* Button callbacks */
@ -57,7 +58,7 @@ set_dir_cb(GtkButton * button, void *data)
GtkWidget *open_dialog =
gtk_file_chooser_dialog_new("Set Project Directory", NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
@ -193,7 +194,7 @@ project_create(lash_client_t * lash_client, const char *const name)
gtk_table_attach(GTK_TABLE(project->properties_table), project->dir_entry,
1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 2);
project->set_dir_button = gtk_button_new_with_label("Browse...");
project->set_dir_button = gtk_button_new_with_label("Move...");
gtk_widget_show(project->set_dir_button);
g_signal_connect(G_OBJECT(project->set_dir_button), "clicked",
G_CALLBACK(set_dir_cb), project);

View File

@ -448,25 +448,17 @@ project_move(project_t * project, const char *new_dir)
if (dir != NULL) {
fprintf(stderr,
"Warning: directory %s exists, it will be moved to %s.lashbak.\n",
new_dir, new_dir);
closedir(dir);
esc_new_proj_bak_dir = (char*)calloc(strlen(esc_new_proj_dir) + 8, sizeof(char));
strncpy(esc_new_proj_bak_dir, esc_new_proj_dir, strlen(esc_new_proj_dir + 8));
strncat(esc_new_proj_bak_dir, ".lashbak", strlen(esc_new_proj_dir + 8));
if (rename(esc_new_proj_dir, esc_new_proj_bak_dir)) {
fprintf(stderr, "Unable to backup directory %s to %s.lashbak (%s)",
new_dir, new_dir, strerror(errno));
return;
}
"Can not move project directory to %s - exists\n",
new_dir);
return;
} else if (dir == NULL && errno == ENOTDIR) {
fprintf(stderr,
"Can not move project directory to %s - exists but is not a directory\n",
new_dir);
return;
} else if (dir == NULL && errno == ENOENT) {
printf("Directory %s does not exist, and will be created.\n",
new_dir);
/* This is what we want... */
/*printf("Directory %s does not exist, creating.\n", new_dir);*/
}
/* close all the clients' stores */