Browse Source

Comment the LV2 TTL generator

pull/278/head
Jean Pierre Cimalando 4 years ago
parent
commit
4c39d3b472
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      utils/lv2-ttl-generator/lv2_ttl_generator.c

+ 7
- 0
utils/lv2-ttl-generator/lv2_ttl_generator.c View File

@@ -34,6 +34,8 @@ typedef void (*TTL_Generator_Function)(const char* basename);
static int isPathSeparator(char c); static int isPathSeparator(char c);
static char* makeNormalPath(const char* path); static char* makeNormalPath(const char* path);


// TODO support Unicode paths on the Windows platform

int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc != 2) if (argc != 2)
@@ -68,18 +70,23 @@ int main(int argc, char* argv[])


if (ttlFn != NULL) 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); char* normalPath = makeNormalPath(path);


// get rid of any "./" prefixes
path = normalPath; path = normalPath;
while (path[0] == '.' && path[1] == '/') while (path[0] == '.' && path[1] == '/')
path += 2; path += 2;


// extract the file name part
char* basename = strrchr(path, '/'); char* basename = strrchr(path, '/');
if (basename != NULL) if (basename != NULL)
basename += 1; basename += 1;
else else
basename = (char*)path; basename = (char*)path;


// remove the file extension
char* dotPos = strrchr(basename, '.'); char* dotPos = strrchr(basename, '.');
if (dotPos) if (dotPos)
*dotPos = '\0'; *dotPos = '\0';


Loading…
Cancel
Save