]> sigrok.org Git - libsigrokdecode.git/blobdiff - decode.c
Don't print .py suffix in protocol decoder names.
[libsigrokdecode.git] / decode.c
index 7125d32f44f9b63c6709d4ebe0fd5508814f14ce..3a1f63da64147f47b2f86e81b8edf4889e12e9a5 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -60,9 +60,10 @@ int sigrokdecode_init(void)
                return SIGROKDECODE_ERR_DECODERS_DIR;
 
        while ((dp = readdir(dir)) != NULL) {
-               if (!strstr(dp->d_name, ".py"))
+               if (!g_str_has_suffix(dp->d_name, ".py"))
                        continue;
-               if ((tmp = strdup(dp->d_name)))
+               /* For now use the filename (without .py) as decoder name. */
+               if ((tmp = g_strndup(dp->d_name, strlen(dp->d_name) - 3)))
                        list_pds = g_slist_append(list_pds, tmp);
        }
        closedir(dir);