commit 4c39d3b472b23aeeddbc2dd11af43f4d68054343
parent caaf8ea39ccb5dd9f47621dae84c7fc57e78fcca
Author: Jean Pierre Cimalando <jp-dev@inbox.ru>
Date: Mon, 24 May 2021 19:57:05 +0200
Comment the LV2 TTL generator
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/utils/lv2-ttl-generator/lv2_ttl_generator.c b/utils/lv2-ttl-generator/lv2_ttl_generator.c
@@ -34,6 +34,8 @@ typedef void (*TTL_Generator_Function)(const char* basename);
static int isPathSeparator(char c);
static char* makeNormalPath(const char* path);
+// TODO support Unicode paths on the Windows platform
+
int main(int argc, char* argv[])
{
if (argc != 2)
@@ -68,18 +70,23 @@ int main(int argc, char* argv[])
if (ttlFn != NULL)
{
+ // convert the paths to a normalized form, such that path separators are
+ // replaced with '/', and duplicate separators are removed
char* normalPath = makeNormalPath(path);
+ // get rid of any "./" prefixes
path = normalPath;
while (path[0] == '.' && path[1] == '/')
path += 2;
+ // extract the file name part
char* basename = strrchr(path, '/');
if (basename != NULL)
basename += 1;
else
basename = (char*)path;
+ // remove the file extension
char* dotPos = strrchr(basename, '.');
if (dotPos)
*dotPos = '\0';