Skip to content

Commit f6e1a21

Browse files
author
falkTX
committed
Fix loading filenames starting with "file://" (used in lv2 presets)
1 parent f7ae707 commit f6e1a21

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drmr.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,17 @@ static void* load_thread(void* arg) {
3131
DrMr* drmr = (DrMr*)arg;
3232
drmr_sample *loaded_samples,*old_samples;
3333
int loaded_count, old_scount;
34-
char *request;
34+
char *request, *request_orig;
3535
for(;;) {
3636
pthread_mutex_lock(&drmr->load_mutex);
3737
pthread_cond_wait(&drmr->load_cond,
3838
&drmr->load_mutex);
3939
pthread_mutex_unlock(&drmr->load_mutex);
4040
old_samples = drmr->samples;
4141
old_scount = drmr->num_samples;
42-
request = drmr->request_buf[drmr->curReq];
42+
request_orig = request = drmr->request_buf[drmr->curReq];
43+
if (!strncmp(request, "file://", 7))
44+
request += 7;
4345
loaded_samples = load_hydrogen_kit(request,drmr->rate,&loaded_count);
4446
if (!loaded_samples) {
4547
fprintf(stderr,"Failed to load kit at: %s\n",request);
@@ -57,7 +59,7 @@ static void* load_thread(void* arg) {
5759
pthread_mutex_unlock(&drmr->load_mutex);
5860
}
5961
if (old_scount > 0) free_samples(old_samples,old_scount);
60-
drmr->current_path = request;
62+
drmr->current_path = request_orig;
6163
current_kit_changed = 1;
6264
}
6365
return 0;

drmr_ui.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,8 @@ port_event(LV2UI_Handle handle,
723723
lv2_atom_object_get(obj, ui->uris.kit_path, &path, 0);
724724
if (path) {
725725
char *kitpath = LV2_ATOM_BODY(path);
726+
if (!strncmp(kitpath, "file://", 7))
727+
kitpath += 7;
726728
char *realp = realpath(kitpath,NULL);
727729
if (!realp) {
728730
fprintf(stderr,"Passed a path I can't resolve, bailing out\n");

0 commit comments

Comments
 (0)