[PD-cvs] pd/src s_file.c,1.8.2.1,1.8.2.2

Hans-Christoph Steiner eighthave at users.sourceforge.net
Wed May 23 07:04:51 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15932

Modified Files:
      Tag: branch-v0-39-2-extended
	s_file.c 
Log Message:
created the ability to embed the preferences file into the Pd.app in Pd.app/Contents/Resources/org.puredata.pd.plist

Index: s_file.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_file.c,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -d -r1.8.2.1 -r1.8.2.2
*** s_file.c	19 Dec 2006 05:55:44 -0000	1.8.2.1
--- s_file.c	23 May 2007 05:04:49 -0000	1.8.2.2
***************
*** 216,220 ****
      char cmdbuf[256];
      int nread = 0, nleft = size;
!     snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n", key);
      FILE *fp = popen(cmdbuf, "r");
      while (nread < size)
--- 216,231 ----
      char cmdbuf[256];
      int nread = 0, nleft = size;
! 	char embedded_prefs[MAXPDSTRING];
! 	char user_prefs[MAXPDSTRING];
! 	char cwd[MAXPDSTRING];
! 	char *homedir = getenv("HOME");
!     struct stat statbuf;
! 	getcwd(cwd, MAXPDSTRING);
! 	snprintf(embedded_prefs, MAXPDSTRING, "%s/../org.puredata.pd", cwd);
! 	snprintf(user_prefs, MAXPDSTRING, "%s/Library/Preferences/org.puredata.pd.plist", homedir);
! 	if (stat(user_prefs, &statbuf) == 0)
! 		snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n", key);
! 	else 
! 		snprintf(cmdbuf, 256, "defaults read %s %s 2> /dev/null\n", embedded_prefs, key);
      FILE *fp = popen(cmdbuf, "r");
      while (nread < size)





More information about the Pd-cvs mailing list