Sort headers using clang-tidy
[geeqie.git] / src / lua.cc
index f0b0add..8319147 100644 (file)
@@ -24,6 +24,8 @@
 
 #define _XOPEN_SOURCE
 
+#include "glua.h"
+
 #include <cstdio>
 #include <cstring>
 #include <ctime>
 #include <glib.h>
 #include <lua.hpp>
 
+#include "debug.h"
+#include "exif.h"
+#include "filedata.h"
+#include "main-defines.h"
 #include "main.h"
-#include "glua.h"
 #include "ui-fileops.h"
-#include "exif.h"
 
 /**
  * @file
@@ -258,13 +262,12 @@ static int lua_exif_get_datum(lua_State *L)
                        lua_pushnumber(L, datetime);
                        return 1;
                        }
-               else
-                       {
-                       lua_pushnil(L);
-                       return 1;
-                       }
+
+               lua_pushnil(L);
+               return 1;
                }
-       else if (strcmp(key, "Exif.Photo.DateTimeDigitized") == 0)
+
+       if (strcmp(key, "Exif.Photo.DateTimeDigitized") == 0)
                {
                memset(&tm, 0, sizeof(tm));
                if (value && strptime(value, "%Y:%m:%d %H:%M:%S", &tm))
@@ -273,11 +276,9 @@ static int lua_exif_get_datum(lua_State *L)
                        lua_pushnumber(L, datetime);
                        return 1;
                        }
-               else
-                       {
-                       lua_pushnil(L);
-                       return 1;
-                       }
+
+               lua_pushnil(L);
+               return 1;
                }
        lua_pushstring(L, value);
        return 1;
@@ -360,8 +361,7 @@ gchar *lua_callvalue(FileData *fd, const gchar *file, const gchar *function)
        std::unique_ptr<gchar, decltype(&g_free)> path{g_build_filename(get_rc_dir(), "lua", file, NULL), g_free};
        if (access(path.get(), R_OK) == -1)
                {
-               /** @FIXME what is the correct way to find the scripts folder? */
-               path.reset(g_build_filename("/usr/local/lib", GQ_APPNAME_LC, file, NULL));
+               path.reset(g_build_filename(gq_bindir, file, NULL));
                if (access(path.get(), R_OK) == -1)
                        {
                        return g_strdup("");