Skip to content

Commit

Permalink
Fix loading filenames starting with "file://" (used in lv2 presets)
Browse files Browse the repository at this point in the history
  • Loading branch information
falkTX committed Oct 24, 2014
1 parent f7ae707 commit f6e1a21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drmr.c
Expand Up @@ -31,15 +31,17 @@ static void* load_thread(void* arg) {
DrMr* drmr = (DrMr*)arg;
drmr_sample *loaded_samples,*old_samples;
int loaded_count, old_scount;
char *request;
char *request, *request_orig;
for(;;) {
pthread_mutex_lock(&drmr->load_mutex);
pthread_cond_wait(&drmr->load_cond,
&drmr->load_mutex);
pthread_mutex_unlock(&drmr->load_mutex);
old_samples = drmr->samples;
old_scount = drmr->num_samples;
request = drmr->request_buf[drmr->curReq];
request_orig = request = drmr->request_buf[drmr->curReq];
if (!strncmp(request, "file://", 7))
request += 7;
loaded_samples = load_hydrogen_kit(request,drmr->rate,&loaded_count);
if (!loaded_samples) {
fprintf(stderr,"Failed to load kit at: %s\n",request);
Expand All @@ -57,7 +59,7 @@ static void* load_thread(void* arg) {
pthread_mutex_unlock(&drmr->load_mutex);
}
if (old_scount > 0) free_samples(old_samples,old_scount);
drmr->current_path = request;
drmr->current_path = request_orig;
current_kit_changed = 1;
}
return 0;
Expand Down
2 changes: 2 additions & 0 deletions drmr_ui.c
Expand Up @@ -723,6 +723,8 @@ port_event(LV2UI_Handle handle,
lv2_atom_object_get(obj, ui->uris.kit_path, &path, 0);
if (path) {
char *kitpath = LV2_ATOM_BODY(path);
if (!strncmp(kitpath, "file://", 7))
kitpath += 7;
char *realp = realpath(kitpath,NULL);
if (!realp) {
fprintf(stderr,"Passed a path I can't resolve, bailing out\n");
Expand Down

0 comments on commit f6e1a21

Please sign in to comment.