On Sat, Jan 10, 2015 at 10:13 PM, Ludovic Courtès <l...@gnu.org> wrote: > Very good! Could you add the story about XDG_DATA_DIRS > vs. XDG_DATA_HOME as a comment above the phase?
Will do. > >> + (let ((sounds (string-append >> + (assoc-ref inputs "sound-theme-freedesktop") >> + "/share"))) >> + (substitute* "src/sound-theme-spec.c" >> + (("return \"/usr/local/share:/usr/share\";") >> + (string-append "return \"" sounds "\";\n" >> + " else {\n" >> + " const char *stp = \":" >> + sounds "\";\n" >> + " size_t len = strlen(stp) + " >> + "strlen(g) + 1;\n" >> + " " >> + "char *g2 = (char*) malloc(len);\n" >> + " return " >> + "strcat(strcpy(g2, g), stp);\n" >> + " }"))))) > > Why not just: > > (string-append "return \"" sounds "\";") > > ? The first "return" is used in an "if" clause that checks that XDG_DATA_DIRS is either empty, or not defined. The variable "g" is a pointer to a string contains the value of XDG_DATA_DIRS. I'm adding an "else" with a second "return" to add the sounds directory even when XDG_DATA_DIRS is defined (the unpatched program does returns "g" in this case and therefore the sounds would not be found). Regards, Fede