Additional debug features
[geeqie.git] / src / ui_fileops.c
index c75ead5..c4466fc 100644 (file)
@@ -41,6 +41,9 @@
 #include "ui_utildlg.h"        /* for locale warning dialog */
 #include "md5-util.h"
 
+#include "filefilter.h"
+#include "secure_save.h"
+
 /*
  *-----------------------------------------------------------------------------
  * generic file information and manipulation routines (public)
@@ -55,6 +58,8 @@ void print_term(const gchar *text_utf8)
 
        text_l = g_locale_from_utf8(text_utf8, -1, NULL, NULL, NULL);
        fputs((text_l) ? text_l : text_utf8, stderr);
+       if(command_line && command_line->ssi)
+               secure_fputs(command_line->ssi, (text_l) ? text_l : text_utf8);
        g_free(text_l);
 }
 
@@ -697,7 +702,7 @@ gchar *unique_filename_simple(const gchar *path)
        name = filename_from_path(path);
        if (!name) return NULL;
 
-       ext = extension_from_path(name);
+       ext = registered_extension_from_path(name);
 
        if (!ext)
                {
@@ -729,24 +734,14 @@ const gchar *filename_from_path(const gchar *path)
 
 gchar *remove_level_from_path(const gchar *path)
 {
-       gint p = 0, n = -1;
+       const gchar *base;
 
        if (!path) return NULL;
 
-       while (path[p])
-               {
-               if (path[p] == G_DIR_SEPARATOR) n = p;
-               p++;
-               }
-       if (n <= 0) n++;
-
-       return g_strndup(path, (gsize) n);
-}
+       base = strrchr(path, G_DIR_SEPARATOR);
+       if (base) return g_strndup(path, strlen(path)-strlen(base));
 
-const gchar *extension_from_path(const gchar *path)
-{
-       if (!path) return NULL;
-       return strrchr(path, '.');
+       return NULL;
 }
 
 gboolean file_extension_match(const gchar *path, const gchar *ext)
@@ -766,18 +761,13 @@ gboolean file_extension_match(const gchar *path, const gchar *ext)
 
 gchar *remove_extension_from_path(const gchar *path)
 {
-       gint p = 0, n = -1;
+       const gchar *reg_ext;
 
        if (!path) return NULL;
 
-       while (path[p])
-               {
-               if (path[p] == '.') n = p;
-               p++;
-               }
-       if (n < 0) n = p;
+       reg_ext = registered_extension_from_path(path);
 
-       return g_strndup(path, (gsize) n);
+       return g_strndup(path, strlen(path) - (reg_ext == NULL ? 0 : strlen(reg_ext)));
 }
 
 void parse_out_relatives(gchar *path)