/*
* This file is part of DisOrder
- * Copyright (C) 2005, 2006 Richard Kettlewell
+ * Copyright (C) 2005, 2006, 2007 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "filepart.h"
#include "words.h"
-const char *find_track_root(const char *track) {
+const struct collection *find_track_collection(const char *track) {
int n;
size_t l, tl = strlen(track);
&& track[l] == '/')
break;
}
- if(n >= config->collection.n) {
- error(0, "found track in no collection '%s'", track);
+ if(n < config->collection.n)
+ return &config->collection.s[n];
+ else
return 0;
- }
- return config->collection.s[n].root;
+}
+
+const char *find_track_root(const char *track) {
+ const struct collection *c = find_track_collection(track);
+ if(c)
+ return c->root;
+ error(0, "found track in no collection '%s'", track);
+ return 0;
}
const char *track_rootless(const char *track) {