[gtranslator: 1/2] gtr-dl-teams.c: Repeated filename parts




commit 4c23779251fafcadc763ac57041761b5b2049048
Author: Edwin Ajong <edwinajong gmail com>
Date:   Sun Mar 20 22:47:39 2022 +0100

    gtr-dl-teams.c: Repeated filename parts
    
    After downloading a translation file (ex: alacarte in french),
    the file is saved displayed is alacarte.master.alacarte.master.fr.po
    instead of alacarte.master.fr.po
    
    Removed two strings which were allocated to the filename
    which caused the repetition.
    
    Fixes #125

 src/gtr-dl-teams.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index f98f7a77..91bf5469 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -497,7 +497,6 @@ gtr_dl_teams_load_po_file (GtkButton *button, GtrDlTeams *self)
   int file_index = 0;
   const char *dest_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
   g_autofree char *basename = NULL;
-  g_autofree char *filename = NULL;
   g_autofree char *file_path = NULL;
   g_autoptr(GFile) dest_file = NULL;
   gboolean reserve_first = FALSE;
@@ -590,16 +589,13 @@ gtr_dl_teams_load_po_file (GtkButton *button, GtrDlTeams *self)
   /* Save file to Downloads; file basename is the part from last / character on */
   basename = g_path_get_basename (priv->file_path);
   // Remove the extension
-  filename = g_strdup_printf ("%s.%s.%s", priv->selected_module, priv->selected_branch, basename);
-  g_free (basename);
-  basename = g_strdup (filename);
   file_path = g_strconcat ("file://", dest_dir, "/", basename, NULL);
   dest_file = g_file_new_for_uri (file_path);
 
   ret = g_file_copy (tmp_file, dest_file, G_FILE_COPY_NONE, NULL, NULL, NULL, &error);
   while (!ret && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
     {
-      g_autofree char *tmpname = gtr_utils_get_filename (filename);
+      g_autofree char *tmpname = gtr_utils_get_filename (basename);
       g_free (basename);
       g_free (file_path);
       g_object_unref (dest_file);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]