Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11078
Modified Files: Tag: branch-v0-39-2-extended s_file.c Log Message: added code to embed default preferences file on GNU/Linux, similar to the Mac OS X embedded preferences
Index: s_file.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_file.c,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -C2 -d -r1.8.2.4 -r1.8.2.5 *** s_file.c 17 Jun 2007 05:11:14 -0000 1.8.2.4 --- s_file.c 8 Jul 2007 22:51:22 -0000 1.8.2.5 *************** *** 43,50 **** char filenamebuf[MAXPDSTRING], *homedir = getenv("HOME"); int fd, length;
! if (!homedir) ! return; ! snprintf(filenamebuf, MAXPDSTRING, "%s/.pdsettings", homedir); filenamebuf[MAXPDSTRING-1] = 0; if ((fd = open(filenamebuf, 0)) < 0) --- 43,62 ---- char filenamebuf[MAXPDSTRING], *homedir = getenv("HOME"); int fd, length; + char user_prefs_file[MAXPDSTRING]; // user prefs file + char default_prefs_file[MAXPDSTRING]; // default prefs embedded in the package + struct stat statbuf;
! ! snprintf(default_prefs_file, MAXPDSTRING, "%s/default.pdsettings", ! sys_libdir->s_name); ! // fprintf(stderr,"default_prefs %s\n",default_prefs_file); ! if (homedir) ! snprintf(user_prefs_file, MAXPDSTRING, "%s/.pdsettings", homedir); ! if (stat(user_prefs_file, &statbuf) == 0) ! strncpy(filenamebuf, user_prefs_file, MAXPDSTRING); ! else if (stat(default_prefs_file, &statbuf) == 0) ! strncpy(filenamebuf, default_prefs_file, MAXPDSTRING); ! else ! return; filenamebuf[MAXPDSTRING-1] = 0; if ((fd = open(filenamebuf, 0)) < 0)