Fix loading filenames starting with "file://" (used in lv2 presets)
This commit is contained in:
parent
f7ae7079c9
commit
f6e1a21108
8
drmr.c
8
drmr.c
@ -31,7 +31,7 @@ static void* load_thread(void* arg) {
|
|||||||
DrMr* drmr = (DrMr*)arg;
|
DrMr* drmr = (DrMr*)arg;
|
||||||
drmr_sample *loaded_samples,*old_samples;
|
drmr_sample *loaded_samples,*old_samples;
|
||||||
int loaded_count, old_scount;
|
int loaded_count, old_scount;
|
||||||
char *request;
|
char *request, *request_orig;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
pthread_mutex_lock(&drmr->load_mutex);
|
pthread_mutex_lock(&drmr->load_mutex);
|
||||||
pthread_cond_wait(&drmr->load_cond,
|
pthread_cond_wait(&drmr->load_cond,
|
||||||
@ -39,7 +39,9 @@ static void* load_thread(void* arg) {
|
|||||||
pthread_mutex_unlock(&drmr->load_mutex);
|
pthread_mutex_unlock(&drmr->load_mutex);
|
||||||
old_samples = drmr->samples;
|
old_samples = drmr->samples;
|
||||||
old_scount = drmr->num_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);
|
loaded_samples = load_hydrogen_kit(request,drmr->rate,&loaded_count);
|
||||||
if (!loaded_samples) {
|
if (!loaded_samples) {
|
||||||
fprintf(stderr,"Failed to load kit at: %s\n",request);
|
fprintf(stderr,"Failed to load kit at: %s\n",request);
|
||||||
@ -57,7 +59,7 @@ static void* load_thread(void* arg) {
|
|||||||
pthread_mutex_unlock(&drmr->load_mutex);
|
pthread_mutex_unlock(&drmr->load_mutex);
|
||||||
}
|
}
|
||||||
if (old_scount > 0) free_samples(old_samples,old_scount);
|
if (old_scount > 0) free_samples(old_samples,old_scount);
|
||||||
drmr->current_path = request;
|
drmr->current_path = request_orig;
|
||||||
current_kit_changed = 1;
|
current_kit_changed = 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -723,6 +723,8 @@ port_event(LV2UI_Handle handle,
|
|||||||
lv2_atom_object_get(obj, ui->uris.kit_path, &path, 0);
|
lv2_atom_object_get(obj, ui->uris.kit_path, &path, 0);
|
||||||
if (path) {
|
if (path) {
|
||||||
char *kitpath = LV2_ATOM_BODY(path);
|
char *kitpath = LV2_ATOM_BODY(path);
|
||||||
|
if (!strncmp(kitpath, "file://", 7))
|
||||||
|
kitpath += 7;
|
||||||
char *realp = realpath(kitpath,NULL);
|
char *realp = realpath(kitpath,NULL);
|
||||||
if (!realp) {
|
if (!realp) {
|
||||||
fprintf(stderr,"Passed a path I can't resolve, bailing out\n");
|
fprintf(stderr,"Passed a path I can't resolve, bailing out\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user