diff options
author | Chris Robinson <[email protected]> | 2016-02-24 04:21:03 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-02-24 04:21:03 -0800 |
commit | d04970e568de8747a152db1ab036bbbfbf70f7f1 (patch) | |
tree | e9befe157c01e0eda777490ff598b4324fe5830a | |
parent | 93d73aae4d66ac558c7f6bdd601d9d4b371448ca (diff) |
Exclude the file extension from the HRTF name
-rw-r--r-- | Alc/hrtf.c | 10 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 8 |
2 files changed, 13 insertions, 5 deletions
@@ -514,6 +514,7 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename) struct Hrtf *hrtf = NULL; const HrtfEntry *iter; const char *name; + const char *ext; ALchar magic[8]; FILE *f; int i; @@ -575,10 +576,17 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename) /* TODO: Get a human-readable name from the HRTF data (possibly coming in a * format update). */ + ext = strrchr(name, '.'); i = 0; do { - al_string_copy_cstr(&entry.name, name); + if(!ext) + al_string_copy_cstr(&entry.name, name); + else + { + al_string_clear(&entry.name); + al_string_append_range(&entry.name, name, ext); + } if(i != 0) { char str[64]; diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 498be083..79c52a56 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -359,12 +359,12 @@ QStringList MainWindow::collectHrtfs() if(fname.endsWith(".mhr", Qt::CaseInsensitive)) { if(!ret.contains(fname)) - ret.push_back(fname); + ret.push_back(fname.left(fname.length()-4)); else { size_t i = 1; do { - QString s = fname+" #"+QString::number(i); + QString s = fname.left(fname.length()-4)+" #"+QString::number(i); if(!ret.contains(s)) { ret.push_back(s); @@ -389,12 +389,12 @@ QStringList MainWindow::collectHrtfs() if(fname.endsWith(".mhr", Qt::CaseInsensitive)) { if(!ret.contains(fname)) - ret.push_back(fname); + ret.push_back(fname.left(fname.length()-4)); else { size_t i = 1; do { - QString s = fname+" #"+QString::number(i); + QString s = fname.left(fname.length()-4)+" #"+QString::number(i); if(!ret.contains(s)) { ret.push_back(s); |