This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository rage.

View the commit online.

commit 9832288a309d303e59dbf74b816901a9a6572167
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Mon Jun 8 21:46:25 2026 +0100

    add -dir option to give specific dir to scan for browser
---
 src/bin/main.c | 11 +++++++++++
 src/bin/util.c | 49 +++++++++++++++++++++++++++++++------------------
 src/bin/util.h |  1 +
 3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/src/bin/main.c b/src/bin/main.c
index 9c8a2f1..180ea85 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -210,6 +210,9 @@ elm_main(int argc, char **argv)
                     "    -d DEPTH\n"
                     "      Set maximum level of recursion.\n"
                     "      The default is %d. Set to 0 for unlimited.\n"
+                    "    -dir directory/to/scan\n"
+                    "      Use this directory to scan for videos instead\n"
+                    "      of ~/Videos\n"
                     , DEPTH_DEFAULT);
              exit(0);
           }
@@ -243,6 +246,14 @@ elm_main(int argc, char **argv)
                   if (vid) eina_stringshare_replace(&(vid->sub), argv[i]);
                }
           }
+        else if (!strcmp(argv[i], "-dir"))
+          {
+             if (i < (argc - 1))
+               {
+                 i++;
+                 util_videos_dir_set(argv[i]);
+               }
+          }
         else
           {
              char *realpath = strdup(argv[i]);
diff --git a/src/bin/util.c b/src/bin/util.c
index 2316307..43b2137 100644
--- a/src/bin/util.c
+++ b/src/bin/util.c
@@ -44,27 +44,40 @@ util_audio_ok(const char *path)
    return EINA_FALSE;
 }
 
+static char *_vid_dir = NULL;
+
+void
+util_videos_dir_set(const char *dir)
+{
+  if (_vid_dir) free(_vid_dir);
+  _vid_dir = NULL;
+  if (dir) _vid_dir = strdup(dir);
+}
+
 char *
 util_videos_dir_get(void)
 {
-   char buf[PATH_MAX];
-   const char *vids, *home;
-   char *vidsreal = NULL, *homereal = NULL;
+  char buf[PATH_MAX];
+  const char *vids, *home;
+  char *vidsreal = NULL, *homereal = NULL;
 
-   vids = efreet_videos_dir_get();
-   if (vids) vidsreal = ecore_file_realpath(vids);
-   home = eina_environment_home_get();
-   if (home) homereal = ecore_file_realpath(home);
-   if ((vidsreal) && (homereal))
-     {
-        if (!strcmp(vidsreal, homereal)) vids = NULL;
-     }
-   free(vidsreal);
-   free(homereal);
-   if (vids)
-     snprintf(buf, sizeof(buf), "%s", vids);
-   else
-     snprintf(buf, sizeof(buf), "%s/Videos", eina_environment_home_get());
-   return strdup(buf);
+  if (_vid_dir)
+    { // if explicitly set - use this
+      vidsreal = ecore_file_realpath(_vid_dir);
+      if (vidsreal) return vidsreal;
+    }
+  vids = efreet_videos_dir_get();
+  if (vids)
+    { // if efreet has a video dir - use that
+      vidsreal = ecore_file_realpath(vids);
+      if (vidsreal) return vidsreal;
+    }
+  // fallback - homedir + Videos
+  home = eina_environment_home_get();
+  if (home) homereal = ecore_file_realpath(home);
+  if (!homereal) return strdup("/tmp");
+  snprintf(buf, sizeof(buf), "%s/Videos", homereal);
+  free(homereal);
+  return strdup(buf);
 }
 
diff --git a/src/bin/util.h b/src/bin/util.h
index cd933db..b81d5ac 100644
--- a/src/bin/util.h
+++ b/src/bin/util.h
@@ -3,6 +3,7 @@
 
 Eina_Bool  util_video_ok(const char *path);
 Eina_Bool  util_audio_ok(const char *path);
+void       util_videos_dir_set(const char *dir);
 char      *util_videos_dir_get(void);
 
 #endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to